mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-03 21:34:59 +00:00
[wip] add actions to crud
This commit is contained in:
@@ -22,6 +22,7 @@ namespace Chill\MainBundle\CRUD\Templating;
|
||||
|
||||
use Chill\MainBundle\CRUD\Resolver\Resolver;
|
||||
use Twig\TwigFilter;
|
||||
use Twig\TwigFunction;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\Environment;
|
||||
|
||||
@@ -50,6 +51,14 @@ class TwigCRUDResolver extends AbstractExtension
|
||||
];
|
||||
}
|
||||
|
||||
public function getFunctions()
|
||||
{
|
||||
return [
|
||||
new TwigFunction('chill_crud_config', [$this, 'getConfig'],
|
||||
['is_safe' => 'html'])
|
||||
];
|
||||
}
|
||||
|
||||
public function display(Environment $env, $entity, $path): string
|
||||
{
|
||||
$data = $this->resolver->getData($entity, $path);
|
||||
@@ -57,5 +66,10 @@ class TwigCRUDResolver extends AbstractExtension
|
||||
|
||||
return $env->render($template, ['data' => $data, 'entity' => $entity, ]);
|
||||
}
|
||||
|
||||
public function getConfig($configKey, $crudName, $action = null)
|
||||
{
|
||||
return $this->resolver->getConfigValue($configKey, $crudName, $action);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user