src/CoreBundle/EventListener/DcGeneral/Table/FilterSetting/PasteButtonListener.php
public function handle(GetPasteButtonEvent $event)
    {
        $model = $event->getModel();
        if (('tl_metamodel_filtersetting' !== $model->getProviderName())) {
            return;
        }

        $environment = $event->getEnvironment();
        $model       = $event->getModel();
        $clipboard   = $environment->getClipboard();

        $filter = Filter::create()->andModelIs(ModelId::fromModel($model))->andActionIs(ItemInterface::CUT);
        // Disable all buttons if there is a circular reference.
        if ($event->isCircularReference() || !$clipboard->isEmpty($filter)) {
            $event
                ->setPasteAfterDisabled(true)
                ->setPasteIntoDisabled(true);

            return;
        }
        $factory = $this->filterFactory->getTypeFactory($model->getProperty('type'));

        // If setting does not support children, omit them.
        if ($model->getId() && !($factory && $factory->isNestedType())) {
            $event->setPasteIntoDisabled(true);
        }
    }
public function handle(GetPasteButtonEvent $event)
    {
        $model = $event->getModel();
        if (('tl_metamodel_filtersetting' !== $model->getProviderName())) {
            return;
        }

        $environment = $event->getEnvironment();
        $model       = $event->getModel();
        $clipboard   = $environment->getClipboard();

        $filter = Filter::create()->andModelIs(ModelId::fromModel($model))->andActionIs(ItemInterface::CUT);
        // Disable all buttons if there is a circular reference.
        if ($event->isCircularReference() || !$clipboard->isEmpty($filter)) {
            $event
                ->setPasteAfterDisabled(true)
                ->setPasteIntoDisabled(true);

            return;
        }
        $factory = $this->filterFactory->getTypeFactory($model->getProperty('type'));

        // If setting does not support children, omit them.
        if ($model->getId() && !($factory && $factory->isNestedType())) {
            $event->setPasteIntoDisabled(true);
        }
    }
public function handle ( GetPasteButtonEvent $ event ) { $ model = $ event -> getModel ( ) ; if ( ( 'tl_metamodel_filtersetting' !== $ model -> getProviderName ( ) ) ) { return ; } $ environment = $ event -> getEnvironment ( ) ; $ model = $ event -> getModel ( ) ; $ clipboard = $ environment -> getClipboard ( ) ; $ filter = Filter :: create ( ) -> andModelIs ( ModelId :: fromModel ( $ model ) ) -> andActionIs ( ItemInterface :: CUT ) ; // Disable all buttons if there is a circular reference. if ( $ event -> isCircularReference ( ) || ! $ clipboard -> isEmpty ( $ filter ) ) { $ event -> setPasteAfterDisabled ( true ) -> setPasteIntoDisabled ( true ) ; return ; } $ factory = $ this -> filterFactory -> getTypeFactory ( $ model -> getProperty ( 'type' ) ) ; // If setting does not support children, omit them. if ( $ model -> getId ( ) && ! ( $ factory && $ factory -> isNestedType ( ) ) ) { $ event -> setPasteIntoDisabled ( true ) ; } }
Generate the paste button.

@param GetPasteButtonEvent $event The event.

@return void
Generate the paste button .