[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?)
H
Hroβ€’391d ago
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
public static function getBlockTitle(?Block $block = null): string
{
return Str::replace('Block', '', Str::afterLast(static::class, '\\'));
}
public static function getBlockTitle(?Block $block = null): string
{
return Str::replace('Block', '', Str::afterLast(static::class, '\\'));
}
A
agnonymβ€’383d ago
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?
H
Hroβ€’383d ago
I'll have to check this. Will try to do it in the afternoon
A
agnonymβ€’383d ago
Thanks @hro1337, no hurry, I just wanted to not let the subject die. Let me know if I can do something about this
H
Hroβ€’382d ago
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...
A
agnonymβ€’380d ago
Thx @hro1337 !!
Want results from more Discord servers?
Add your server
More Posts
[3.0.0] componentBlock overriding getBlockIcon doesn't seem to work?(Successfully changed the title by overriding it's static function) Checked twill:list:icon for the[3.0.0] Maintaining automated Permalink Generation when using getCreateForm to add fields.As soon as I add any fields, using the Formbuilder on this function, the automated permalink disappemulti select selected optionsI'm using the multi select as documented in https://twill.io/docs/form-fields/multi-select.html#mult[3.0.0-rc4] - How to show current value in a select form fieldCurrently I have my select field defined as: `@formField('select', [ 'name' => 'work_year', [3.0.0-rc4] Images not found on remote server - League\\Glide\\Filesystem\\FileNotFoundExceptionI just went from my local to my remote server and some images are showing up others are getting a 5[Twill2] Do settings section support media and how?As title says, is it possible to inject media here or should I make a custom settings singleton to h[3.x.dev] Call to undefined method ReflectionUnionType::getName()Newbie to Twill here. Fresh install of Laravel 10.4.1 / PHP 8.2.4 / MYSQL 8.0.32 on Ubuntu Budgie 2Add custom icons into twillI add the icons into the path `resource/views/admin/icons` and I run the command, result is ok, but Select an another block in a block?Hi everyone, I have a function to create a new block with name "Columns block". With this block, usMedia Library / Glide only loading JPEGsHey there, So I had a Laravel/Twill app running successfully on a subdomain with no issue. Today IAdding a vue componentGood afternoon Tell me what could be the problem? On the main page of the admin panel there is an aSave title in translationsI'm trying to save my title as a translatable field, normal fied works fine but when i make it transSet translations to activeWhile trying to set translations to active it isn't saved to database? Only english is selectablecan't use Published, Draft, Trash filters on module indexI see the buttons, they show the correct counts in the parenthesis, but when I click on them, I alwamedias XHR request with wrong schemeGreetings... I'm having trouble with accessing media library in the admin area in production. Mixeremove positioning and nesting from the page indexGood morning. Tell me how to remove positioning and nesting from the page index in the admin panel? Connecting additional fields depending on the value in the record when selected in the browser compoGood morning. Can you tell me if it is possible to implement the doing in twill? I have a browser iCustom function in a Module ControllerI need to trigger a custom function that is run after a user clicks "Update" for a post in a Twill mTiptap WYSIWYGHi everyone, I would like to know if there is a way to use toolbar align options with tiptap type wySorting by a translation field (ie, title)Hi everyone, I feel like I must be missing something simple (as usual) or am making something overly