/**
  * Parse the defined container scoped operations and populate the definition.
  *
  * @param Contao2BackendViewDefinitionInterface $view The backend view configuration definition to populate.
  *
  * @return void
  */
 protected function parseGlobalOperations(Contao2BackendViewDefinitionInterface $view)
 {
     $operationsDca = $this->getFromDca('list/global_operations');
     if (!is_array($operationsDca)) {
         return;
     }
     $collection = $view->getGlobalCommands();
     foreach (array_keys($operationsDca) as $operationName) {
         $command = $this->createCommand($operationName, $operationsDca[$operationName]);
         $collection->addCommand($command);
     }
 }
Exemplo n.º 2
0
 /**
  * Add the select command to the backend view definition.
  *
  * @param Contao2BackendViewDefinitionInterface $view      The backend view definition.
  * @param IMetaModelDataDefinition              $container The metamodel data definition.
  *
  * @return void
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  * @SuppressWarnings(PHPMD.CamelCaseVariableName)
  */
 protected function addSelectCommand(Contao2BackendViewDefinitionInterface $view, $container)
 {
     /** @var BasicDefinitionInterface $definition */
     $definition = $container->getBasicDefinition();
     // No ations allowed. Don't add the select command button.
     if (!$definition->isEditable() && !$definition->isDeletable() && !$definition->isCreatable()) {
         return;
     }
     $commands = $view->getGlobalCommands();
     $command = new SelectCommand();
     // FIXME: Use the translator to translate the labels.
     $command->setName('all')->setLabel($GLOBALS['TL_LANG']['MSC']['all'][0])->setDescription($GLOBALS['TL_LANG']['MSC']['all'][1]);
     $parameters = $command->getParameters();
     $parameters['act'] = 'select';
     $extra = $command->getExtra();
     $extra['class'] = 'header_edit_all';
     $commands->addCommand($command);
 }