Button handlers -> show button when entry past validation
Created 8 years ago by michielIs there possible way to show a button in a table when an entry past some conditions something like this
'edit',
'permissions' => [
'button' => 'info',
'icon' => 'lock',
'href' => 'admin/users/permissions/{entry.id}',
'permission' => function($entry){
if($entry->permission)
return true;
else
return false;
}
],
];
Ok - so most of any UI object builder supports handlers because of this little ditty: https://github.com/anomalylabs/streams-platform/blob/master/src/Ui/Table/Command/SetDefaultParameters.php#L54
Basically anything not skipped that has a setter can be defined as a handler and not only that but can be detected automatically via classname transformation:
Handlers should have a
handle
method that can accept the original builder instance. Method injection / dependency injection is supported too since it's called from the service container. Just define your handler to set the properties on the builder: