/**
  * Create a frontend editor for the given table.
  *
  * @param string $containerName The name of the data container to edit.
  *
  * @param string $defaultAction The default action to issue, if none provided by the input provider.
  *
  * @return string
  */
 public function editFor($containerName, $defaultAction = 'showAll')
 {
     $environment = $this->createDcGeneral($containerName);
     $actionName = $environment->getInputProvider()->getParameter('act') ?: $defaultAction;
     $action = new Action($actionName);
     $event = new ActionEvent($environment, $action);
     $this->dispatcher->dispatch(DcGeneralEvents::ACTION, $event);
     if (!($result = $event->getResponse())) {
         return 'Action ' . $action->getName() . ' is not supported yet.';
     }
     return $result;
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function handle(Action $action)
 {
     $event = new ActionEvent($this->getEnvironment(), $action);
     $this->getEnvironment()->getEventPropagator()->propagate(DcGeneralEvents::ACTION, $event, array($this->getEnvironment()->getDataDefinition()->getName(), $action->getName()));
     return $event->getResponse();
 }