Giter Club home page Giter Club logo

Comments (3)

soullivaneuh avatar soullivaneuh commented on May 26, 2024

I agree with this suggestion. 👍

And I think it should have default action like show and edit.

from sonataadminbundle.

webdevilopers avatar webdevilopers commented on May 26, 2024

How about an addAction method? In my use case I need to dynamically add action depending on roles:

        if ($this->securityContext->isGranted('ROLE_SONATA_ADMIN_BUNDLE_LIST')) {
            $listMapper
                ->add('_action', 'actions', array(
                    'actions' => array(
                        'show' => array(),
                        'edit' => array(),
                        'show_bundles' => array('template' => 'AcmeContractBundle:ContractAdmin:list__bundles.html.twig'),
                    ))
                )
            ;
        }

Normally show and edit would be added by default as suggested by @soullivaneuh .
I would have to create an $actions var to finally pass it to the actions parameter.

It would be nice to simply use:

if ($this->securityContext->isGranted('ROLE_SONATA_ADMIN_BUNDLE_LIST')) {
    $listMapper->addAction( 'show_bundles' => array('template' => 'AcmeContractBundle:ContractAdmin:list__bundles.html.twig'),
            ))
        );
}

Source:
https://github.com/sonata-project/SonataAdminBundle/blob/master/Datagrid/ListMapper.php#L73-81

from sonataadminbundle.

core23 avatar core23 commented on May 26, 2024

This issue is very old. Feel free to reopen, if the error still exists.

A PR would be welcome if you reopen this issue.

from sonataadminbundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.