In TableBuilder buttons, can I add variables other then {entry.id} ?
Created 7 years ago by lckamal

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  —  7 years ago

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

lckamal  —  7 years ago

Is there some example done prior?

ryanthompson  —  7 years 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