Closed hason closed 1 year ago
Same here, apparently actions added in configureActions
are not know by $context->getCrud()->getActionsConfig()
in AbstractCrudController
.
+1
+1
will i get the solution by creating a twig file extending
{% extends '@EasyAdmin/page/content.html.twig' %}
{% block page_content %}
<h1 class="font-weight-bold text-danger .display1 ">
{{user_name}} </h1>
{% endblock %}
and configuring my Action to render that page
public function configureActions(Actions $actions): Actions
{
$viewCadeaux = Action::new('viewCadeaux', 'Cadeaux', 'fa fa-file-invoice')
->linkToCrudAction('cadeaux');
return $actions
->add(Crud::PAGE_INDEX, $viewCadeaux);
}
public function cadeaux(AdminContext $context)
{
$ganante = $context->getEntity()->getInstance();
return $this->render('winner.html.twig', [
'user_name' => $ganante->getPlayer()->getName(),
]);
}
Hope this can help 😄
return $actions->add("customPage", Action::index);
unfortunately I haven't found a solution yet
Hi! I'm trying to do something similar... Is it possible to to create (custom) pages besides the built-in ones?
AdminContextFactory->create(...) and crud->setPageTitle(...) are checking that pageName are the four base ones
I confirm. I cannot create a custom action even though the docs are telling otherwise ☹️. I think it is a BUG and not a FEATURE.
I've created:
$operatorList = Action::new('operatorList', 'Operator list')
->linkToCrudAction('operatorList');
$actions->add(Crud::PAGE_DETAIL, $operatorList);
and getting:
Call to a member function all() on array
There is something wrong in ActionFactory
, as $actionsDto->getActions()
tells that can return an array also, which is invalid when executing all()
method from its output.
I would like to implement global action
trash
which show list of deleted entity (custom query builder for softdeleteable entity).Unfortunately, an exception is thrown:
The problem is that I can't define the page that belongs to the action. For all custom actions is
pageName
set to null (https://github.com/EasyCorp/EasyAdminBundle/blob/master/src/Factory/AdminContextFactory.php#L50-L52).It would be nice to be able to define CRUD page for custom action, eg. for different lists (Index, Trash, List with predefined filters, etc.), various editing edit pages with different forms…
Note: How to properly get action name in
createIndexQueryBuilder
method without hack (see example above)?