# fluent-cart/1.3.26/app/Modules/Templating/Bricks/BricksHelper.php

FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler, version 1.3.26. 66 lines.

- Page: https://pluginprobe.com/plugins/fluent-cart/1.3.26/code/app/Modules/Templating/Bricks/BricksHelper.php
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.3.26/raw/app/Modules/Templating/Bricks/BricksHelper.php
- Modified: 2025-11-20T13:11:16+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/fluent-cart/1.3.26/code/app/Modules/Templating/Bricks/BricksHelper.php#L10-L20`.

```php
<?php

namespace FluentCart\App\Modules\Templating\Bricks;

use Bricks\Frontend;
use FluentCart\Framework\Support\Arr;

class BricksHelper
{

    static public $forcedPost = null;

    public static function getFormCurrentPost()
    {
        return self::$forcedPost;
    }

    public static function setFormCurrentPost($post)
    {
        self::$forcedPost = $post;
    }

    public static function getCategoriesOptions()
    {
        $categories = get_terms(array(
            'taxonomy'   => 'product-categories',
            'hide_empty' => false,
            'orderby'    => 'name'
        ));

        $options = [];
        if (!is_wp_error($categories) && !empty($categories)) {
            foreach ($categories as $category) {
                $options[$category->term_id] = $category->name;
            }
        }

        return $options;
    }

    public static function renderCollectionCard($settings, $post, $post_index = 1, $uid = '')
    {
        $content = Frontend::get_content_wrapper($settings, Arr::get($settings, 'fields', []), $post);

        if ($post_index === 1) {
            echo "<div data-fluent-client-id='" . esc_attr($uid) . "' data-template-provider='bricks' data-fct-product-card class='fct-product-card repeater-item'>";
        } else {
            echo "<div data-fct-product-card class='fct-product-card repeater-item'>";
        }

        $linkedProduct = isset($settings['linkProduct']) ? $settings['linkProduct'] : false;

        if ($linkedProduct && strpos($content, '<a ') === false) {
            echo '<a href="' . esc_attr(get_the_permalink($post)) . '">';
        }

        echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped

        if ($linkedProduct && strpos($content, '<a ') === false) {
            echo '</a>';
        }

        echo '</div>';
    }
}

```
