sonata-project / SonataAdminBundle

The missing Symfony Admin Generator
https://docs.sonata-project.org/projects/SonataAdminBundle
MIT License
2.11k stars 1.26k forks source link

Missing label on breadcrumb menu when using custom action in CRUDController #3174

Closed webdevilopers closed 8 years ago

webdevilopers commented 9 years ago

I have created a custom show action (inspection_results) and route inside my ContractAdminController.

class ContractAdmin extends Admin
{
    protected function configureRoutes(RouteCollection $collection)
    {
        $collection
            ->remove('delete')
            ->remove('export')
        ;

        $collection->add('inspection_results', $this->getRouterIdParameter().'/inspection_results');
    }
}

Technically everything works fine so far!

The I recognized that my breadcrumb menu was missing the label for my Contract entity. Instead it was directely showing the menu label Ergebniszusammenstellung for my action: bildschirmfoto vom 2015-08-14 10 37 15

Looking at the showAction of the CRUDController I add the setSubject method: https://github.com/sonata-project/SonataAdminBundle/blob/master/Controller/CRUDController.php#L843

Now the label for my Contract entity appears: bildschirmfoto vom 2015-08-14 10 40 09

But as you can see now the label of the action Ergebniszusammenstellung is missing at the final position.

Is there another variable I have to pass to the template?

            return $this->render('AppBundle:ContractAdmin:inspection_results.html.twig', array(
                'action'                         => 'inspection_results',
//                'action'                         => 'show',
                'object'                         => $contract
            ));

Possibly related:

core23 commented 8 years ago

This issue should be fixed in the latest master version. Please have a look at the docs.

If this is still present, feel free to reopen this issue