Esempio n. 1
0
 /**
  * Set the visibility condition for the widget.
  *
  * @param BuildDataDefinitionEvent $event The event.
  *
  * @return void
  */
 public function setParentTableVisibility(BuildDataDefinitionEvent $event)
 {
     foreach ($event->getContainer()->getPalettesDefinition()->getPalettes() as $palette) {
         foreach ($palette->getProperties() as $property) {
             if ($property->getName() != 'ptable') {
                 continue;
             }
             $chain = $property->getVisibleCondition();
             if (!($chain && $chain instanceof PropertyConditionChain && $chain->getConjunction() == PropertyConditionChain::AND_CONJUNCTION)) {
                 $chain = new PropertyConditionChain(array($property->getVisibleCondition()), PropertyConditionChain::AND_CONJUNCTION);
                 $property->setVisibleCondition($chain);
             }
             $chain->addCondition(new PropertyValueCondition('rendertype', 'ctable'));
         }
     }
 }
 /**
  * Load all additional definitions, like naming of parent data provider etc.
  *
  * @param ContainerInterface       $container The container where the data shall be stored.
  *
  * @param BuildDataDefinitionEvent $event     The event being emitted.
  *
  * @return void
  */
 protected function loadAdditionalDefinitions(ContainerInterface $container, BuildDataDefinitionEvent $event)
 {
     if (($providers = $this->getFromDca('dca_config/data_provider')) !== null) {
         $event->getDispatcher()->addListener(sprintf('%s[%s]', PopulateEnvironmentEvent::NAME, $container->getName()), function (PopulateEnvironmentEvent $event) {
             $environment = $event->getEnvironment();
             $definition = $environment->getDataDefinition();
             $parentName = $definition->getBasicDefinition()->getParentDataProvider();
             if ($parentName) {
                 $factory = DcGeneralFactory::deriveEmptyFromEnvironment($environment)->setContainerName($parentName);
                 $parentDefinition = $factory->createContainer();
                 $environment->setParentDataDefinition($parentDefinition);
             }
             $rootName = $definition->getBasicDefinition()->getRootDataProvider();
             if ($rootName) {
                 $factory = DcGeneralFactory::deriveEmptyFromEnvironment($environment)->setContainerName($rootName);
                 $rootDefinition = $factory->createContainer();
                 $environment->setRootDataDefinition($rootDefinition);
             }
         });
     }
 }
Esempio n. 3
0
 /**
  * Set the visibility condition for the widget.
  *
  * Manipulate the data definition for the property "rendergrouptype" in table "tl_metamodel_dca_sortgroup".
  *
  * @param BuildDataDefinitionEvent $event The event.
  *
  * @return void
  */
 public function setVisibility(BuildDataDefinitionEvent $event)
 {
     foreach ($event->getContainer()->getPalettesDefinition()->getPalettes() as $palette) {
         foreach ($palette->getProperties() as $property) {
             if ($property->getName() != 'rendergrouptype') {
                 continue;
             }
             self::addCondition($property, new PropertyConditionChain(array(new InputScreenRenderModeIs('flat'), new InputScreenRenderModeIs('parented')), PropertyConditionChain::OR_CONJUNCTION));
         }
     }
 }
Esempio n. 4
0
 /**
  * Build the data definition palettes.
  *
  * @param BuildDataDefinitionEvent $event The event.
  *
  * @return void
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  * @SuppressWarnings(PHPMD.CamelCaseVariableName)
  */
 public function buildPaletteRestrictions(BuildDataDefinitionEvent $event)
 {
     if ($event->getContainer()->getName() !== 'tl_metamodel_dcasetting') {
         return;
     }
     $palettes = $event->getContainer()->getPalettesDefinition();
     $legend = null;
     foreach ($palettes->getPalettes() as $palette) {
         $condition = new PropertyValueCondition('dcatype', 'attribute');
         $legend = $this->getLegend('functions', $palette, $legend);
         $property = $this->getProperty('readonly', $legend);
         $this->addCondition($property, $condition);
         $legend = $this->getLegend('title', $palette, $legend);
         $property = $this->getProperty('attr_id', $legend);
         $this->addCondition($property, $condition);
         $condition = new PropertyValueCondition('dcatype', 'legend');
         $legend = $this->getLegend('title', $palette);
         $property = $this->getProperty('legendtitle', $legend);
         $this->addCondition($property, $condition);
         $property = $this->getProperty('legendhide', $legend);
         $this->addCondition($property, $condition);
         if (!isset($GLOBALS['TL_DCA']['tl_metamodel_dcasetting']['metasubselectpalettes']['attr_id'])) {
             continue;
         }
         foreach ((array) $GLOBALS['TL_DCA']['tl_metamodel_dcasetting']['metasubselectpalettes']['attr_id'] as $typeName => $paletteInfo) {
             foreach ($paletteInfo as $legendName => $properties) {
                 foreach ($properties as $propertyName) {
                     $condition = new InputScreenAttributeIs($typeName);
                     $legend = $this->getLegend($legendName, $palette);
                     $property = $this->getProperty($propertyName, $legend);
                     $this->addCondition($property, $condition);
                 }
             }
         }
     }
 }
Esempio n. 5
0
 /**
  * Build the data definition palettes.
  *
  * @param BuildDataDefinitionEvent $event The event.
  *
  * @return void
  */
 public function buildPaletteRestrictions(BuildDataDefinitionEvent $event)
 {
     if ($event->getContainer()->getName() !== 'tl_metamodel_attribute') {
         return;
     }
     $this->buildConditions(array('tag_id' => false, 'tag_where' => false, 'tag_filter' => true, 'tag_filterparams' => true), $event->getContainer()->getPalettesDefinition());
 }
Esempio n. 6
0
 /**
  * Set the filter params visible or not.
  *
  * @param BuildDataDefinitionEvent $event The event.
  *
  * @return void
  */
 public function visibleFilterParams(BuildDataDefinitionEvent $event)
 {
     if ($event->getContainer()->getName() !== 'tl_metamodel_searchable_pages') {
         return;
     }
     foreach ($event->getContainer()->getPalettesDefinition()->getPalettes() as $palette) {
         foreach ($palette->getProperties() as $property) {
             if ($property->getName() != 'filterparams') {
                 continue;
             }
             $chain = $property->getVisibleCondition();
             if (!($chain && $chain instanceof PropertyConditionChain && $chain->getConjunction() == PropertyConditionChain::AND_CONJUNCTION)) {
                 $chain = new PropertyConditionChain($chain ?: array(), PropertyConditionChain::AND_CONJUNCTION);
                 $property->setVisibleCondition($chain);
             }
             $chain->addCondition(new NotCondition(new PropertyValueCondition('filter', 0)));
             break;
         }
     }
 }
 /**
  * @param BuildDataDefinitionEvent $event
  */
 public function injectGALegend(BuildDataDefinitionEvent $event)
 {
     if ($event->getContainer()->getName() != 'orm_avisota_message') {
         return;
     }
     $container = $event->getContainer();
     $palettesDefinition = $container->getPalettesDefinition();
     $palettes = $palettesDefinition->getPalettes();
     $gAPalette = null;
     foreach ($palettes as $palette) {
         if ($palette->getName() === '__google_analytics__') {
             $gAPalette = $palette;
         }
     }
     if (!$gAPalette) {
         return;
     }
     foreach ($palettes as $palette) {
         if ($palette->getName() === '__google_analytics__') {
             continue;
         }
         foreach ($gAPalette->getLegends() as $gALegend) {
             $palette->addLegend(clone $gALegend);
         }
     }
 }
Esempio n. 8
0
 /**
  * Handle a build data definition event for MetaModels.
  *
  * @param BuildDataDefinitionEvent $event The event payload.
  *
  * @return void
  */
 public function build(BuildDataDefinitionEvent $event)
 {
     $dispatcher = $this->serviceContainer->getEventDispatcher();
     $container = $event->getContainer();
     /** @var $container IMetaModelDataDefinition */
     $this->parseMetaModelDefinition($container);
     $this->parseProperties($container);
     $this->parseBasicDefinition($container);
     $this->parseDataProvider($container);
     $this->parseBackendView($container);
     $this->parsePanels($container);
     $this->parsePalettes($container);
     // Attach renderer to event.
     RenderItem::register($dispatcher);
 }
Esempio n. 9
0
 /**
  * Build the data definition palettes.
  *
  * @param BuildDataDefinitionEvent $event The event.
  *
  * @return void
  */
 public function buildPaletteConditions(BuildDataDefinitionEvent $event)
 {
     if ($event->getContainer()->getName() !== 'tl_metamodel_rendersetting') {
         return;
     }
     $palettes = $event->getContainer()->getPalettesDefinition();
     foreach ($palettes->getPalettes() as $palette) {
         if ($palette->getName() !== 'default') {
             $paletteCondition = $palette->getCondition();
             if (!$paletteCondition instanceof ConditionChainInterface || $paletteCondition->getConjunction() !== PaletteConditionChain::OR_CONJUNCTION) {
                 $paletteCondition = new PaletteConditionChain($paletteCondition ? array($paletteCondition) : array(), PaletteConditionChain::OR_CONJUNCTION);
                 $palette->setCondition($paletteCondition);
             }
             $paletteCondition->addCondition(new PaletteCondition($palette->getName()));
         }
         $this->buildMetaPaletteConditions($palette);
     }
 }