Contao\PageTree::validator PHP Метод

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

Return an array if the "multiple" attribute is set
protected validator ( mixed $varInput ) : mixed
$varInput mixed
Результат mixed
    protected function validator($varInput)
    {
        // Store the order value
        if ($this->orderField != '') {
            $arrNew = explode(',', \Input::post($this->strOrderName));
            // Only proceed if the value has changed
            if ($arrNew !== $this->{$this->orderField}) {
                $this->Database->prepare("UPDATE {$this->strTable} SET tstamp=?, {$this->orderField}=? WHERE id=?")->execute(time(), serialize($arrNew), $this->activeRecord->id);
                $this->objDca->createNewVersion = true;
                // see #6285
            }
        }
        // Return the value as usual
        if ($varInput == '') {
            if ($this->mandatory) {
                $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['mandatory'], $this->strLabel));
            }
            return '';
        } elseif (strpos($varInput, ',') === false) {
            return $this->multiple ? array(intval($varInput)) : intval($varInput);
        } else {
            $arrValue = array_map('intval', array_filter(explode(',', $varInput)));
            return $this->multiple ? $arrValue : $arrValue[0];
        }
    }