MetaModels\DcGeneral\Dca\Builder\Builder::ensureSubmitElement PHP Метод

ensureSubmitElement() защищенный Метод

If no submit element is present, this method will create one at the end of the last row.
protected ensureSubmitElement ( ContaoCommunityAlliance\DcGeneral\DataDefinition\Definition\View\PanelRowCollectionInterface $panelRows ) : void
$panelRows ContaoCommunityAlliance\DcGeneral\DataDefinition\Definition\View\PanelRowCollectionInterface The panel rows.
Результат void
    protected function ensureSubmitElement($panelRows)
    {
        // Check if we have a submit button.
        $hasSubmit = false;
        foreach ($panelRows as $panelRow) {
            foreach ($panelRow as $element) {
                if ($element instanceof SubmitElementInformationInterface) {
                    $hasSubmit = true;
                    break;
                }
                if ($hasSubmit) {
                    break;
                }
            }
        }
        // If not add a submit.
        if (!$hasSubmit && $panelRows->getRowCount()) {
            $row = $panelRows->getRow($panelRows->getRowCount() - 1);
            $row->addElement(new DefaultSubmitElementInformation(), 0);
        }
    }