APF_Demo_ManageOptions_Reset::replyToValidateFields PHP Method

replyToValidateFields() public method

public replyToValidateFields ( $aInputs, $aOldInputs, $oFactory, $aSubmitInfo ) : array
return array
    public function replyToValidateFields($aInputs, $aOldInputs, $oFactory, $aSubmitInfo)
    {
        $_bIsValid = true;
        $_aErrors = array();
        // If the pressed button is not the one with the check box, do not set a field error.
        if ('submit_skip_confirmation' !== $aSubmitInfo['field_id']) {
            return $aInputs;
        }
        if (!$aInputs['reset_confirmation_check']) {
            $_bIsValid = false;
            $_aErrors[$this->_sSectionID]['reset_confirmation_check'] = __('Please check the check box to confirm you want to reset the settings.', 'admin-page-framework-loader');
        }
        if (!$_bIsValid) {
            $oFactory->setFieldErrors($_aErrors);
            $oFactory->setSettingNotice(__('Please help us to help you.', 'admin-page-framework-loader'));
            return $aOldInputs;
        }
        // Delete the basic usage example framework options as well.
        delete_option('APF_BasicUsage');
        return $aInputs;
    }