APF_Demo_PageMetaBox__Normal::validate PHP Method

validate() public method

Alternatively, use the validation_{instantiated class name}() method instead.
public validate ( $aInputs, $aOldInputs, $oAdminPage )
    public function validate($aInputs, $aOldInputs, $oAdminPage)
    {
        $_bIsValid = true;
        $_aErrors = array();
        // You can check the passed values with the log() method of the oDebug object.
        // $this->oDebug->log( $aInputs );
        // $this->oDebug->log( $aOldInputs );
        // Validate the submitted data.
        if (strlen(trim($aInputs['metabox_text_field'])) < 3) {
            $_aErrors['metabox_text_field'] = __('The entered text is too short! Type more than 2 characters.', 'admin-page-framework-loader') . ': ' . $aInputs['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 $aOldInputs;
        }
        return $aInputs;
    }