Пример #1
0
 /**
  * Load the collection of child items and the parent item for the currently selected parent item.
  *
  * @return CollectionInterface
  */
 public function loadCollection()
 {
     $environment = $this->getEnvironment();
     $dataProvider = $environment->getDataProvider();
     $dataConfig = $environment->getBaseConfigRegistry()->getBaseConfig();
     $listingConfig = $this->getViewSection()->getListingConfig();
     $panel = $this->getPanel();
     ViewHelpers::initializeSorting($panel, $dataConfig, $listingConfig);
     return $dataProvider->fetchAll($dataConfig);
 }
Пример #2
0
 /**
  * Initialize the panels for known actions so that they always know their state.
  *
  * @param ActionEvent $event The event.
  *
  * @return void
  */
 public function initializePanels(ActionEvent $event)
 {
     if (!in_array($event->getAction()->getName(), array('copy', 'create', 'paste', 'delete', 'move', 'undo', 'edit', 'toggle', 'showAll', 'show'))) {
         return;
     }
     $environment = $event->getEnvironment();
     $definition = $environment->getDataDefinition();
     $view = $environment->getView();
     if (!$definition->hasDefinition(Contao2BackendViewDefinitionInterface::NAME) || !$view instanceof BaseView || !$view->getPanel()) {
         return;
     }
     /** @var Contao2BackendViewDefinitionInterface $backendDefinition */
     $backendDefinition = $definition->getDefinition(Contao2BackendViewDefinitionInterface::NAME);
     $listingConfig = $backendDefinition->getListingConfig();
     $dataConfig = $environment->getBaseConfigRegistry()->getBaseConfig();
     $panel = $view->getPanel();
     ViewHelpers::initializeSorting($panel, $dataConfig, $listingConfig);
 }