function _options_properties
Describes the preparation steps required by each widget.
1 call to _options_properties()
- options_field_widget_form in modules/
field/ modules/ options/ options.module - Implements hook_field_widget_form().
File
-
modules/
field/ modules/ options/ options.module, line 184
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.