# give/4.15.3/src/Campaigns/Blocks/CampaignComments/Controller/BlockRenderController.php

GiveWP – Donation Plugin and Fundraising Platform, version 4.15.3. 26 lines.

- Page: https://pluginprobe.com/plugins/give/4.15.3/code/src/Campaigns/Blocks/CampaignComments/Controller/BlockRenderController.php
- Raw: https://pluginprobe.com/plugins/give/4.15.3/raw/src/Campaigns/Blocks/CampaignComments/Controller/BlockRenderController.php
- Modified: 2025-04-16T13:25:04+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.15.3/code/src/Campaigns/Blocks/CampaignComments/Controller/BlockRenderController.php#L10-L20`.

```php
<?php

namespace Give\Campaigns\Blocks\CampaignComments\Controller;

use Give\Campaigns\Blocks\CampaignComments\DataTransferObjects\BlockAttributes;

/**
 * @since 4.0.0
 */
class BlockRenderController
{
    /**
     * @since 4.0.0
     */
    public function render(array $attributes, string $secondaryColor): string
    {
        $blockAttributes = BlockAttributes::fromArray($attributes);

        $encodedAttributes = json_encode($blockAttributes->toArray());

        $blockId = $blockAttributes->blockId;

        return "<div id='givewp-campaign-comments-block-{$blockId}' data-secondary-color='{$secondaryColor}' data-givewp-campaign-comments data-attributes='{$encodedAttributes}'></div>";
    }
}

```
