2lenet/crudit-bundle
Symfony bundle to rapidly build configurable CRUD back offices with SB Admin layout. Provides list views with pagination, sorting, actions, exports and batch ops, plus datasources, filters, menus, workflows, maps, markdown and Twig helpers.
When you override a brick, you sometimes have to use your own template.
To do this, you can use the ->setTemplate method and specify the path to your template
:warning: The path you need to specify is only the folder where your
index.html.twigfile is located.
$indexBricks[] = ListConfig::new()
->addFields($this->getFields(CrudConfigInterface::INDEX))
->setTemplate('crudit/commande/list');
You can add conditions to the brick, using the resource or the request, in order to decide whether to display the brick based on the data or the request.
To do this, simply use setDisplayIf (for the data) or setDisplayIfByRequest (for the request):
SublistConfig::new('subResourceField', $this->subResourceCrudConfig)
->setFields($this->subResourceCrudConfig->getFields(CrudConfigInterface::INDEX))
->setActions($this->subResourceCrudConfig->getItemActions())
->setDisplayIf(fn(Resource $resource) => $resource->isActive())
->setDisplayIfByRequest(fn(Request $request) => $request->query->has('actif'))
How can I help you explore Laravel packages today?