You are here

function optionwidgets_options in Content Construction Kit (CCK) 6

Same name and namespace in other branches
  1. 6.3 modules/optionwidgets/optionwidgets.module \optionwidgets_options()
  2. 6.2 modules/optionwidgets/optionwidgets.module \optionwidgets_options()

Helper function for finding the allowed values list for a field.

See if there is a module hook for the option values. Otherwise, try content_allowed_values() for an options list.

5 calls to optionwidgets_options()
optionwidgets_buttons_process in modules/optionwidgets/optionwidgets.module
Process an individual element.
optionwidgets_data2form in modules/optionwidgets/optionwidgets.module
Helper function to transpose the values as stored in the database to the format the widget needs. Can be called anywhere this transformation is needed.
optionwidgets_form2data in modules/optionwidgets/optionwidgets.module
Helper function to transpose the values returned by submitting the widget to the format to be stored in the field. Can be called anywhere this transformation is needed.
optionwidgets_onoff_process in modules/optionwidgets/optionwidgets.module
Process an individual element.
optionwidgets_select_process in modules/optionwidgets/optionwidgets.module
Process an individual element.

File

modules/optionwidgets/optionwidgets.module, line 339
Defines selection, check box and radio button widgets for text and numeric fields.

Code

function optionwidgets_options($field) {
  $function = $field['module'] . '_allowed_values';
  $options = function_exists($function) ? $function($field) : (array) content_allowed_values($field);

  // Add an empty choice for non required radios and single-selects.
  if ($field['widget']['type'] != 'optionwidgets_onoff' && !$field['required'] && !$field['multiple']) {
    $options = array(
      '' => theme('optionwidgets_none', $field),
    ) + $options;
  }
  return $options;
}