MetaModels\DcGeneral\Dca\Builder\Builder::parsePanelSearch PHP Method

parsePanelSearch() protected method

Add search element to the panel.
protected parsePanelSearch ( ContaoCommunityAlliance\DcGeneral\DataDefinition\Definition\View\PanelRowInterface $row ) : void
$row ContaoCommunityAlliance\DcGeneral\DataDefinition\Definition\View\PanelRowInterface The row to which the element shall get added to.
return void
    protected function parsePanelSearch(PanelRowInterface $row)
    {
        if ($row->hasElement('search')) {
            $element = $row->getElement('search');
        } else {
            $element = new DefaultSearchElementInformation();
        }
        if (!$element instanceof SearchElementInformationInterface) {
            throw new \InvalidArgumentException('Search element does not implement the correct interface.');
        }
        foreach ($this->getInputScreenDetails()->getProperties() as $property => $value) {
            if (!empty($value['info']['search'])) {
                $element->addProperty($property);
            }
        }
        if ($element->getPropertyNames() && !$row->hasElement('search')) {
            $row->addElement($element);
        }
    }