APF_MetaBox_BuiltinFieldTypes::validate PHP Method

validate() public method

Alternatively, you may use validataion_{instantiated class name}() method,
public validate ( $aInput, $aOldInput, $oAdmin )
    public function validate($aInput, $aOldInput, $oAdmin)
    {
        $_bIsValid = true;
        $_aErrors = array();
        // You can check the passed values with the log() method of the oDebug object.
        // $this->oDebug->log( $aInput );
        // Validate the submitted data.
        if (strlen(trim($aInput['_metabox_text_field'])) < 3) {
            $_aErrors['_metabox_text_field'] = __('The entered text is too short! Type more than 2 characters.', 'admin-page-framework-loader') . ': ' . $aInput['_metabox_text_field'];
            $_bIsValid = false;
        }
        if (!$_bIsValid) {
            $this->setFieldErrors($_aErrors);
            $this->setSettingNotice(__('There was an error in your input in meta box form fields', 'admin-page-framework-loader'));
            return $aOldInput;
        }
        return $aInput;
    }