wip
This commit is contained in:
79
app/plugins/portfolio/forms.php
Normal file
79
app/plugins/portfolio/forms.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/portfolio/forms.php
|
||||
*
|
||||
* This houses all of the form checking functions for this plugin.
|
||||
*
|
||||
* @package TP Portfolio
|
||||
* @version 3.0
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @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;
|
Reference in New Issue
Block a user