src/CoreBundle/EventListener/DcGeneral/Table/RenderSetting/AddAllButtonListener.php
public function getGlobalButton(GetGlobalButtonEvent $event)
    {
        $environment = $event->getEnvironment();
        if ('addall' !== $event->getKey()
        || 'tl_metamodel_rendersetting' !== $environment->getDataDefinition()->getName()) {
            return;
        }

        $renderSetting = ModelId::fromSerialized($environment->getInputProvider()->getParameter('pid'))->getId();

        $modelId = $this->connection->createQueryBuilder()
            ->select('r.pid')
            ->from('tl_metamodel_rendersettings', 'r')
            ->where('r.id=:pid')
            ->setParameter('pid', $renderSetting)
            ->execute()
            ->fetchColumn();

        $name = $this->factory->translateIdToMetaModelName($modelId);

        $event->setHref(
            $this->urlGenerator->generate(
                'metamodels.rendersetting.add_all',
                ['metaModel' => $name, 'renderSetting' => $renderSetting]
            )
        );
    }
public function getGlobalButton(GetGlobalButtonEvent $event)
    {
        $environment = $event->getEnvironment();
        if ('addall' !== $event->getKey()
        || 'tl_metamodel_rendersetting' !== $environment->getDataDefinition()->getName()) {
            return;
        }

        $renderSetting = ModelId::fromSerialized($environment->getInputProvider()->getParameter('pid'))->getId();

        $modelId = $this->connection->createQueryBuilder()
            ->select('r.pid')
            ->from('tl_metamodel_rendersettings', 'r')
            ->where('r.id=:pid')
            ->setParameter('pid', $renderSetting)
            ->execute()
            ->fetchColumn();

        $name = $this->factory->translateIdToMetaModelName($modelId);

        $event->setHref(
            $this->urlGenerator->generate(
                'metamodels.rendersetting.add_all',
                ['metaModel' => $name, 'renderSetting' => $renderSetting]
            )
        );
    }
Clear the button if the User is not admin.

@param GetGlobalButtonEvent $event The event.

@return void