Files
thetempusproject/app/plugins/portfolio/forms.php
Joey Kimsey 825d422d93 wip
2025-02-06 03:49:00 -05:00

80 lines
2.2 KiB
PHP

<?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;