* @link https://TheTempusProject.com * @license https://opensource.org/licenses/MIT [MIT LICENSE] */ namespace TheTempusProject\Plugins\Portfolio; use TheTempusProject\Bedrock\Functions\Input; use TheTempusProject\Bedrock\Functions\Check; use TheTempusProject\Classes\Forms; class PortfolioForms extends Forms { /** * Adds these functions to the form list. */ public function __construct() { self::addHandler( 'newLink', __CLASS__, 'newLink' ); self::addHandler( 'editLink', __CLASS__, 'editLink' ); } /** * Validates the new position post form. * * @return {bool} */ public static function newLink() { if ( !Input::exists( 'section' ) ) { self::addUserError( 'You must specify section' ); return false; } if ( !Input::exists( 'title' ) ) { self::addUserError( 'You must specify title' ); return false; } if ( !Input::exists( 'url' ) ) { self::addUserError( 'You must specify url' ); return false; } if ( !Input::exists( 'description' ) ) { self::addUserError( 'You must specify description' ); return false; } return true; } /** * Validates the edit position post form. * * @return {bool} */ public static function editLink() { if ( !Input::exists( 'section' ) ) { self::addUserError( 'You must specify section' ); return false; } if ( !Input::exists( 'title' ) ) { self::addUserError( 'You must specify title' ); return false; } if ( !Input::exists( 'url' ) ) { self::addUserError( 'You must specify url' ); return false; } if ( !Input::exists( 'description' ) ) { self::addUserError( 'You must specify description' ); return false; } return true; } } new PortfolioForms;