You are here

function editableviews_handler_field_field_edit::options_form in Editable Views 7

Default options form provides the label widget that all fields should have.

Overrides views_handler_field_field::options_form

File

handlers/editableviews_handler_field_field_edit.inc, line 31

Class

editableviews_handler_field_field_edit
Field handler for toggling between rendered value and edit form element.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $field = field_info_field($this->definition['field_name']);
  module_load_include('inc', 'field_ui', 'field_ui.admin');
  $widget_options = array(
    // Banking on there being no widget type called '0', which is a reasonable
    // assumption to make!
    0 => t('Default'),
  );
  $widget_options += field_ui_widget_type_options($field['type']);
  $form['widget_type'] = array(
    '#type' => 'select',
    '#title' => t('Widget type'),
    '#options' => $widget_options,
    '#default_value' => $this->options['widget_type'],
    '#description' => t("The type of form element you would like to present to the user when editing this field." . ' ' . "'Default' will use the widget from field settings, and may result in different widgets showing if the entities are of different bundles."),
  );
  $form['suppress_label'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hide widget label'),
    '#description' => t('If selected, the label on field widget is hidden. (If the field is required, the * will still show.)'),
    '#default_value' => $this->options['suppress_label'],
  );
  $form['suppress_description'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hide field widget description'),
    '#description' => t('If selected, the description on field widgets is hidden.'),
    '#default_value' => $this->options['suppress_description'],
  );
}