MetaModels\DcGeneral\Events\Table\InputScreen\Subscriber::setParentTableVisibility PHP Method

setParentTableVisibility() public method

Set the visibility condition for the widget.
public setParentTableVisibility ( ContaoCommunityAlliance\DcGeneral\Factory\Event\BuildDataDefinitionEvent $event ) : void
$event ContaoCommunityAlliance\DcGeneral\Factory\Event\BuildDataDefinitionEvent 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'));
            }
        }
    }