In TableBuilder buttons, can I add variables other then {entry.id} ?

lckamal - 1 month ago

In TableBuilder buttons, can I add variables other then {entry.id} ?

eg. admin/items/edit/{entry.slug}

I want to add a locale on admin if translations for only 1 language exists eg.

protected $buttons = [
        'edit' => [
            'icon' => 'fa fa-pencil',
            'type' => 'warning',
            'href' => '/{entry.translations.0.locale}/admin/courts/edit/{entry.id}'
        ],
...
];

so that it will automatically switch to other language and edit for populates all value. In $columns it works so was wondering if same thing works on buttons too. It would be helpful.

ryanthompson - 1 month ago

You can set buttons with a handler and use closures and all kinds of cool stuff ^_^

lckamal - 4 weeks ago

Is there some example done prior?

ryanthompson - 4 weeks ago

https://github.com/anomalylabs/addons-module/blob/master/src/Addon/Table/AddonTableButtons.php

They're picked up automatically if using class name transformation. AddonTableBuilder -> AddonTableButtons