_options_properties
function _options_properties
_options_properties($type, $multiple, $required, $has_value)
Describes the preparation steps required by each widget.
File
- modules/field/modules/options/options.module, line 184
- Defines selection, check box and radio button widgets for text and numeric fields.
Code
function _options_properties($type, $multiple, $required, $has_value) { $base = array( 'filter_xss' => FALSE, 'strip_tags' => FALSE, 'strip_tags_and_unescape' => FALSE, 'empty_option' => FALSE, 'optgroups' => FALSE, ); $properties = array(); switch ($type) { case 'select': $properties = array( // Select boxes do not support any HTML tag. 'strip_tags_and_unescape' => TRUE, 'optgroups' => TRUE, ); if ($multiple) { // Multiple select: add a 'none' option for non-required fields. if (!$required) { $properties['empty_option'] = 'option_none'; } } else { // Single select: add a 'none' option for non-required fields, // and a 'select a value' option for required fields that do not come // with a value selected. if (!$required) { $properties['empty_option'] = 'option_none'; } elseif (!$has_value) { $properties['empty_option'] = 'option_select'; } } break; case 'buttons': $properties = array( 'filter_xss' => TRUE, ); // Add a 'none' option for non-required radio buttons. if (!$required && !$multiple) { $properties['empty_option'] = 'option_none'; } break; case 'onoff': $properties = array( 'filter_xss' => TRUE, ); break; } return $properties + $base; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!field!modules!options!options.module/function/_options_properties/7.x