You are here

function content_widget_type_options in Content Construction Kit (CCK) 6.3

Same name and namespace in other branches
  1. 6.2 includes/content.admin.inc \content_widget_type_options()

Return an array of widget type options for a field type.

If no field type is provided, returns a nested array of all widget types, keyed by field type human name

7 calls to content_widget_type_options()
content_field_basic_form in includes/content.admin.inc
A form element for selecting field, widget, and label.
content_field_edit_form in includes/content.admin.inc
Menu callback; presents the field editing page.
content_field_overview_form in includes/content.admin.inc
Menu callback; listing of fields for a content type.
content_field_type_options in includes/content.admin.inc
Return an array of field_type options.
template_preprocess_content_field_overview_form in theme/theme.inc
@file Theme preprocess function for content-admin-field-overview-form.tpl.php.

... See full list

File

includes/content.admin.inc, line 759
Administrative interface for content type creation.

Code

function content_widget_type_options($field_type = NULL, $by_label = FALSE) {
  static $options;
  if (!isset($options)) {
    $options = array();
    foreach (_content_widget_types() as $widget_type_name => $widget_type) {
      foreach ($widget_type['field types'] as $widget_field_type) {
        $options[$widget_field_type][$widget_type_name] = t($widget_type['label']);
      }
    }
  }
  if ($field_type) {
    return !empty($options[$field_type]) ? $options[$field_type] : array();
  }
  elseif ($by_label) {
    $field_types = _content_field_types();
    $options_by_label = array();
    foreach ($options as $field_type => $widgets) {
      $options_by_label[t($field_types[$field_type]['label'])] = $widgets;
    }
    return $options_by_label;
  }
  else {
    return $options;
  }
}