Log1x / acf-composer

Compose ACF Fields, Blocks, Widgets, and Option Pages with ACF Builder on Sage 10.
https://github.com/Log1x/acf-composer
MIT License
413 stars 56 forks source link

How to get attributes from custom block? #140

Closed sariyanta closed 1 year ago

sariyanta commented 1 year ago

I'm new to acf-composer (and also php) and enjoy using it.

I'm having difficulties retrieving the data from the 'Supported block features.'

I added 'color' => 'true' to the $supports. The changes is applied in the back-end, but couldn't figure out how to use it in the front end.

    /**
     * The supported block features.
     *
     * @var array
     */
    public $supports = array(
        'align'         => true,
        'align_text'    => false,
        'align_content' => false,
        'full_height'   => false,
        'anchor'        => false,
        'mode'          => false,
        'multiple'      => true,
        'jsx'           => true,
        'color'         => true,
    );

Any pointer would be appreciated.

Desar

rleecrewmp commented 1 year ago

In the blade file I am able to use $block->block->textColor and $block->block->backgroundColor

sariyanta commented 1 year ago

Perfect! This works! Thank you @rleecrewmp !