code: public function handle(GetPasteButtonEvent $event)
      {
          if (!$this->wantToHandle($event)) {
              return;
          }
  
          $environment = $event->getEnvironment();
          $model       = $event->getModel();
          $clipboard   = $environment->getClipboard();
          // Disable all buttons if there is a circular reference.
          if ($clipboard->fetch(
              Filter::create()->andActionIs(ItemInterface::CUT)->andModelIs(ModelId::fromModel($model))
          )) {
              $event
                  ->setPasteAfterDisabled(true)
                  ->setPasteIntoDisabled(true);
  
              return;
          }
  
          $typeName = $model->getProperty('type');
          // If setting does not support children, omit them.
          if ($model->getId() && !$this->conditionFactory->supportsNesting($typeName)) {
              $event->setPasteIntoDisabled(true);
              return;
          }
  
          $collector = new ModelCollector($environment);
          if (!$this->acceptsAnotherChild($model, $collector)) {
              $event->setPasteIntoDisabled(true);
          }
  
          $definition    = $environment->getDataDefinition();
          $mode          = $definition->getBasicDefinition()->getMode();
          $relationships = new RelationshipManager($definition->getModelRelationshipDefinition(), $mode);
          if (!$relationships->isRoot($model)
              && ($parent = $collector->searchParentOf($model))
              && !$this->acceptsAnotherChild($parent, $collector)) {
              $event->setPasteAfterDisabled(true);
          }
      }
docs: Generate the paste button.
  
  @param GetPasteButtonEvent $event The event.
  
  @return void