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