mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-02 21:13:57 +00:00
[CRUD] check that action exists before inserting them in edit and view template
This commit is contained in:
@@ -93,4 +93,10 @@ class Resolver
|
||||
'_'.
|
||||
$action);
|
||||
}
|
||||
|
||||
public function hasAction($crudName, $action)
|
||||
{
|
||||
return \array_key_exists($action,
|
||||
$this->crudConfig[$crudName]['actions']);
|
||||
}
|
||||
}
|
||||
|
@@ -47,7 +47,9 @@ class TwigCRUDResolver extends AbstractExtension
|
||||
{
|
||||
return [
|
||||
new TwigFunction('chill_crud_config', [$this, 'getConfig'],
|
||||
['is_safe' => 'html'])
|
||||
['is_safe' => 'html']),
|
||||
new TwigFunction('chill_crud_action_exists', [$this, 'hasAction'],
|
||||
[]),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -55,5 +57,10 @@ class TwigCRUDResolver extends AbstractExtension
|
||||
{
|
||||
return $this->resolver->getConfigValue($configKey, $crudName, $action);
|
||||
}
|
||||
|
||||
public function hasAction($crudName, $action)
|
||||
{
|
||||
return $this->resolver->hasAction($crudName, $action);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user