[3.0.0] Block class - getBlockTitle()
Hi,
I was trying to move Blade blocks to Class. When I wanted to move
@twillBlockTitleField
in class, I thought I had to do my own logic in the getBlockTitle()
method of my class which is supposed to have the block as argument.
But the block is always null, indeed, the only call is in Services\Blocks\Block::parsePropertyFallback()
but without arguments π
Is this supposed to pass the block ? (as A17\Twill\Models\Block
or use A17\Twill\Services\Blocks\Block
?)6 Replies
it is indeed always null. I know why I added is as an optional argument but never really implemented it I think π€¦ββοΈ
you should be able to still use the method to set a title
No problem! π What I wanted to do is set a title depending on a Block content value like
@twillBlockTitleField
in Blade forms, but without the Block instance, I don't see how to do it. But maybe is there an other way to do so in Block classes?
@hro1337 @ifox.dev sorry to bother you, may you explain me how I can achieve the @twillBlockTitleField
feature using a Block class?I'll have to check this. Will try to do it in the afternoon
Thanks @hro1337, no hurry, I just wanted to not let the subject die. Let me know if I can do something about this
@agnonym added pr here: https://github.com/area17/twill/pull/2252
GitHub
Add title prefix support to component blocks. by haringsrob Β· Pull ...
This pr allows component blocks to set the title prefix and title field:
<?php
namespace App\View\Components\Twill\Blocks;
use A17\Twill\Services\Forms\Fields\BlockEditor;
use A17\Twill\Servic...
Thx @hro1337 !!