How to customize Title of Modal when use createOptionForm()
Hello,
Is there a way to customize modal title after clicked on + near select field with createOptionForm() method ?
And so, the tooltip of + button shows always "Create option" (<span class="sr-only">Create option</span>), any tip to customize it ?
Thanks
39 Replies
->createOptionModalHeading('Modal Title')
And for customizing button tooltip, you need to build your own suffix action similar to createOptionsnice for createOptionModalHeading(), I didn't see in docs, so my question
It is not documented but we're always able to "recreate" something similar from the codebase... The codebase is a great cheat sheet for us π
Well, you give me a suffixAction() method, I don't know how to use it...
just copy it
and change everything you want...
yes this part is Ok, I knew this code goes here, thi is the content of suffixAction is complex for me
Afterall, you just want to change tooltip, consider again you really need it or not
copy it and it will just work...
I even copied that from the source code, and modify it using my basic php knowledge
To be sure, In ->form([]) I put fields I want in modals ?
Yes...true
Ok I understand !! ->suffixAction replace ->createOptionForm() and permit to set an icon opening a modal to add new resource.
createOptionForm is basically a set of suffix action with form and preconfigured action
even you can move the button onto the left side of select field just by changing
suffixAction
into prefixAction
... so fun isn't it?yeas absolutely
so in my case, if I use suffixAction I can remove createOptionForm isnt it ?
ah yes remove it
forgot to mention
ok nice
but last thing I don't understand is the hidden() method inside suffixAction
We don't want the plus button to be active when viewing the data
why did you mention in comment change to your resource class
For example if your resource name is PostResource, then change it to ViewPost... you can remove it if you don't have view page for you resource
ok I understood
Like this
Yes , i don't have ViewDish file (I manage meals with dishes) when I create a dish, I have a select field to choose category (starter, dessert etc) and it's for this fiels a apply suffixAction
So remove the hidden method
But accordingly with docs, I set action view directly in modal
what are you trying to do
im kinda lost
this @danharrin
you can customise the action without overriding the whole thing
->createOptionAction(fn ($action) => $action->tooltip('Here?'))
π΅βπ«
you can chain on
->icon()->modalHeading()->modalSubheading()
, whateverlol wow @danharrin
I just gave the example from a part my action.... my action does a lot more, not about tooltip actually π
sorry @yagrasdemonde π
but if we are picky, the title still shows 'Create option' when mouse is on button, below tooltip
thats just your browser though
you can customize that as the
->label()
->label st the label for select field, not for + button
set*
I think put in here for the label()
after $action->
yeah when I posted answer I thank this is the place to be
so wonderful Men
Thank you very much and even @danharrin said a fast way, thank you to @margarizaldi I understood the suffixAction part
it will be nice to mention these possibilities in docs however
π
agreed
im writing the docs for v3 and this is featured
π
Unknown Userβ’2y ago
Message Not Public
Sign In & Join Server To View
page
modal
Unknown Userβ’2y ago
Message Not Public
Sign In & Join Server To View