Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Checkbox Set class for Form Builder
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @since 19 Jul 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -32,7 +32,7 @@ class _CheckboxSet extends Select
|
||||
{
|
||||
$args = func_get_args();
|
||||
$args[3]['multiple'] = TRUE;
|
||||
|
||||
|
||||
call_user_func_array( 'parent::__construct', $args );
|
||||
|
||||
if ( !isset( $this->options['descriptions'] ) )
|
||||
@@ -80,6 +80,13 @@ class _CheckboxSet extends Select
|
||||
$value = $this->value;
|
||||
}
|
||||
|
||||
/* If the value is NULL or an empty string, i.e. from a custom field, then we should not convert it into an array because the
|
||||
value will evaluate to 0 with an == check and the first option in the checkbox set will always be selected erroneously */
|
||||
if ( ! is_array( $value ) AND $value !== NULL AND $value !== '' )
|
||||
{
|
||||
$value = array( $value );
|
||||
}
|
||||
|
||||
return \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->checkboxset( $this->name, $value, $this->required, $this->parseOptions(), $this->options['multiple'], $this->options['class'], $this->options['disabled'], $this->options['toggles'], NULL, $this->options['unlimited'], $this->options['unlimitedLang'], $this->options['unlimitedToggles'], $this->options['unlimitedToggleOn'], $descriptions );
|
||||
}
|
||||
|
||||
@@ -90,6 +97,8 @@ class _CheckboxSet extends Select
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
/* We need the array keys. For custom fields we will have 0 => 1, 1 => 1 if checkboxes 0 and 1 are checked, while for Content we will have
|
||||
customKey => 1, customOtherKey => 1 - we always need the array keys */
|
||||
$value = is_array( parent::getValue() ) ? array_keys( parent::getValue() ) : array();
|
||||
if ( $this->options['returnLabels'] )
|
||||
{
|
||||
@@ -107,6 +116,7 @@ class _CheckboxSet extends Select
|
||||
return $this->options['options'][ $value ];
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user