Commit ca96bfb7 authored by yched's avatar yched

#152892 - better help text for 'single on/off checkbox' widget label.

parent be7b9152
......@@ -10,6 +10,19 @@
* Implementation of hook_help().
*/
function optionwidgets_help($section) {
if (preg_match('|^admin/content/types/([^/]*)/fields/([^/]*)$|', $section, $matches)) {
if (($field = content_fields($matches[2], $matches[1])) && in_array($field['widget']['type'], array_keys(optionwidgets_widget_info()))) {
$output = t('Create a list of options as a list in <strong>Allowed values</strong> or as an array in Php code at the bottom of this page. These values will be the same for the %field in all content types. ', array('%field' => $field['widget']['label']));
if ($field['widget']['type'] == 'options_onoff') {
$output .= '<br/>'. t('For a \'Single on/off checkbox\' widget, define the \'off\' value first, then the \'on\' value in the <strong>Allowed values</strong> section. Note that the checkbox will be labeled with the label of the \'on\' value.');
}
else {
$output .= '<br/>'. t('The \'Checkboxes / radio buttons\' widget will display checkboxes if the multiple values option is selected for this field, otherwise radios will be displayed.');
}
return $output;
}
}
switch ($section) {
case 'admin/modules#description':
return t('<strong>CCK:</strong> Defines selection, check box and radio button widgets for text and numeric fields. <em>Note: Requires content.module, text.module and number.module.</em>');
......@@ -38,24 +51,6 @@ function optionwidgets_widget_info() {
);
}
/**
* Implementation of hook_widget_settings().
*/
function optionwidgets_widget_settings($op, $widget) {
$form = array();
switch ($op) {
case 'form':
$form['#prefix'] = t('Create a list of options as a list in <strong>Allowed values</strong> or as an array in Php code at the bottom of this page. These values will be the same for the %field in all content types. ', array('%field' => $widget['label']));
if ($widget['type'] == 'options_onoff') {
$form['#prefix'] .= t(' For a single on/off checkbox, define the \'off\' value first, then the \'on\' value in the <strong>Allowed values</strong> section.');
}
else {
$form['#prefix'] .= t(' The Check boxes/radio buttons widget will display checkboxes if the multiple values option is selected for this field, otherwise radios will be displayed.');
}
}
return $form;
}
/**
* Implementation of hook_widget().
*/
......@@ -186,7 +181,6 @@ function optionwidgets_widget($op, &$node, $field, &$items) {
}
function _optionwidgets_options($field, $node) {
$types = _content_field_types();
$field_allowed_values = $types[$field['type']]['module'] .'_allowed_values';
if (function_exists($field_allowed_values)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment