Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -11,7 +11,7 @@
|
||||
namespace IPS\Helpers\Form;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -25,11 +25,20 @@ class _Radio extends Select
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $name Name
|
||||
* @param mixed $defaultValue Default value
|
||||
* @param bool|NULL $required Required? (NULL for not required, but appears to be so)
|
||||
* @param array $options Type-specific options
|
||||
* @param callback $customValidationCode Custom validation code
|
||||
* @param string $prefix HTML to show before input field
|
||||
* @param string $suffix HTML to show after input field
|
||||
* @param string $id The ID to add to the row
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct( $name, $defaultValue=NULL, $required=FALSE, $options=array(), $customValidationCode=NULL, $prefix=NULL, $suffix=NULL, $id=NULL )
|
||||
{
|
||||
call_user_func_array( 'parent::__construct', func_get_args() );
|
||||
parent::__construct( $name, $defaultValue, $required, $options, $customValidationCode, $prefix, $suffix, $id );
|
||||
|
||||
if ( !isset( $this->options['descriptions'] ) )
|
||||
{
|
||||
$this->options['descriptions'] = array();
|
||||
@@ -71,17 +80,9 @@ class _Radio extends Select
|
||||
{
|
||||
foreach ( $this->options['options'] as $k => $v )
|
||||
{
|
||||
$key = "{$v}_desc";
|
||||
if ( \IPS\Member::loggedIn()->language()->checkKeyExists( $key ) )
|
||||
{
|
||||
$descriptions[ $k ] = \IPS\Member::loggedIn()->language()->addToStack( $key );
|
||||
}
|
||||
$descriptions[ $k ] = \IPS\Member::loggedIn()->language()->addToStack( "{$v}_desc", FALSE, array( 'returnBlank' => TRUE, 'returnInto' => \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->rowDesc( NULL, NULL ), $this, NULL ) );
|
||||
|
||||
$key = "{$v}_warning";
|
||||
if ( \IPS\Member::loggedIn()->language()->checkKeyExists( $key ) )
|
||||
{
|
||||
$warnings[ $k ] = \IPS\Member::loggedIn()->language()->addToStack( $key );
|
||||
}
|
||||
$warnings[ $k ] = \IPS\Member::loggedIn()->language()->addToStack( "{$v}_warning", FALSE, array( 'returnBlank' => TRUE, 'returnInto' => \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->rowWarning( NULL, NULL, FALSE, NULL, NULL, NULL, $this->name . '_' . $k ), $this, NULL ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +102,7 @@ class _Radio extends Select
|
||||
|
||||
if ( $this->options['parse'] === 'image' )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->radioImages( $this->name, $value, $this->required, $this->options['options'], $this->options['disabled'], $this->options['toggles'], $descriptions, $warnings, $this->options['userSuppliedInput'], $this->options['unlimited'], $this->options['unlimitedLang'], $this->htmlId );
|
||||
return \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->radioImages( $this->name, $value, $this->required, $this->options['options'], $this->options['disabled'], $this->options['toggles'], $descriptions, $warnings, $this->options['userSuppliedInput'], $this->options['unlimited'], $this->options['unlimitedLang'], $this->htmlId, $this->options['gridspan'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -140,7 +141,7 @@ class _Radio extends Select
|
||||
$value = parent::getValue();
|
||||
|
||||
/* Disabled radio fields do not submit a value to the server */
|
||||
if( $this->options['disabled'] === TRUE or ( is_array( $this->options['disabled'] ) and in_array( $value, $this->options['disabled'] ) ) )
|
||||
if( $this->options['disabled'] === TRUE or ( \is_array( $this->options['disabled'] ) and \in_array( $value, $this->options['disabled'] ) ) )
|
||||
{
|
||||
return $this->defaultValue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user