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
419 stars 57 forks source link

Error when Block name is changed #188

Closed Schwankenson closed 9 months ago

Schwankenson commented 9 months ago

I created this block with the acf-composer:

class BootstrapContainer extends Block
{
    public $name = 'Container';
    (...)

I want the class to be named BootstrapContainer. But the user is not interested in technical details, so $name should be just "Container". When I add this. the block content is not loaded anymore in editor. It just shows the loading wheel. Is this intended, that the block can obly be named like the class?

Log1x commented 9 months ago

Did you rename the view to container.blade.php? You would otherwise need to either set $slug or you could define the view path in $view like blocks.bootstrap-container

You can see what's happening here: https://github.com/Log1x/acf-composer/blob/master/src/Block.php#L325-L327

Schwankenson commented 9 months ago

Great, thank you for that quick answer. Settings the slug is exactly what I was looking for. I would even put this in the generated default code. In my case, different block name for devs and editors is always happening while developing. It are different views to the same thing and makes it easier for both of the groups if naming is adapted to the group.

Thank you for this great tool. Without Sage, ACF and tools like yours Wordpress development would not even be half the fun :)