Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

+18 -11
View File
@@ -11,16 +11,21 @@
namespace IPS\Helpers\Form;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use InvalidArgumentException;
use IPS\Helpers\Form;
use function defined;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* Custom input class for Form Builder
*/
class _Custom extends FormAbstract
class Custom extends FormAbstract
{
/**
* @brief Default Options
@@ -32,7 +37,7 @@ class _Custom extends FormAbstract
);
* @endcode
*/
protected $defaultOptions = array(
protected array $defaultOptions = array(
'getHtml' => NULL,
'formatValue' => NULL,
'validate' => NULL,
@@ -43,7 +48,7 @@ class _Custom extends FormAbstract
*
* @return string
*/
public function html()
public function html(): string
{
$htmlFunction = $this->options['getHtml'];
return $htmlFunction( $this );
@@ -52,10 +57,10 @@ class _Custom extends FormAbstract
/**
* Get HTML
*
* @param \IPS\Helpers\Form|null $form Form helper object
* @param Form|null $form Form helper object
* @return string
*/
public function rowHtml( $form=NULL )
public function rowHtml( Form $form=NULL ): string
{
if ( isset( $this->options['rowHtml'] ) )
{
@@ -70,7 +75,7 @@ class _Custom extends FormAbstract
*
* @return mixed
*/
public function formatValue()
public function formatValue(): mixed
{
if ( $this->options['formatValue'] !== NULL )
{
@@ -86,10 +91,10 @@ class _Custom extends FormAbstract
/**
* Validate
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
* @return TRUE
*/
public function validate()
public function validate(): bool
{
parent::validate();
@@ -97,6 +102,8 @@ class _Custom extends FormAbstract
{
$validationFunction = $this->options['validate'];
$validationFunction( $this );
}
}
return TRUE;
}
}