Example #1
0
 /**
  * Handle the paste into and after buttons.
  *
  * @param GetPasteRootButtonEvent $event The event.
  *
  * @return void
  *
  * @throws \RuntimeException When more than one model is contained within the clipboard.
  */
 public function handleRoot(GetPasteRootButtonEvent $event)
 {
     $this->environment = $event->getEnvironment();
     $this->provider = $this->environment->getDataProvider();
     $this->providerName = $this->provider->getEmptyModel()->getProviderName();
     $clipboard = $this->environment->getClipboard();
     $this->currentModel = null;
     $this->disablePI = false;
     // Only run for a MetaModels.
     if (substr($this->providerName, 0, 3) !== 'mm_' || $event->isPasteDisabled()) {
         return;
     }
     $this->checkForAction($clipboard, 'copy');
     $this->checkForAction($clipboard, 'create');
     $this->checkForAction($clipboard, 'cut');
     $event->setPasteDisabled($this->disablePI);
 }