You are here

public static function EntityFieldHandlerHelper::options_form in Entity API 7

Provide an appropriate default option form for a handler.

8 calls to EntityFieldHandlerHelper::options_form()
entity_views_handler_field_boolean::options_form in views/handlers/entity_views_handler_field_boolean.inc
Provide a options form for this handler.
entity_views_handler_field_date::options_form in views/handlers/entity_views_handler_field_date.inc
Provide a options form for this handler.
entity_views_handler_field_duration::options_form in views/handlers/entity_views_handler_field_duration.inc
Default options form provides the label widget that all fields should have.
entity_views_handler_field_entity::options_form in views/handlers/entity_views_handler_field_entity.inc
Default options form provides the label widget that all fields should have.
entity_views_handler_field_numeric::options_form in views/handlers/entity_views_handler_field_numeric.inc
Provide a options form for this handler.

... See full list

File

views/handlers/entity_views_field_handler_helper.inc, line 34
Contains the EntityFieldHandlerHelper class.

Class

EntityFieldHandlerHelper
Helper class containing static implementations of common field handler methods.

Code

public static function options_form($handler, &$form, &$form_state) {
  if (isset($handler->definition['type']) && entity_property_list_extract_type($handler->definition['type'])) {
    $form['list']['mode'] = array(
      '#type' => 'select',
      '#title' => t('List handling'),
      '#options' => array(
        'collapse' => t('Concatenate values using a seperator'),
        'list' => t('Output values as list'),
        'first' => t('Show first (if present)'),
        'count' => t('Show item count'),
      ),
      '#default_value' => $handler->options['list']['mode'],
    );
    $form['list']['separator'] = array(
      '#type' => 'textfield',
      '#title' => t('List seperator'),
      '#default_value' => $handler->options['list']['separator'],
      '#dependency' => array(
        'edit-options-list-mode' => array(
          'collapse',
        ),
      ),
    );
    $form['list']['type'] = array(
      '#type' => 'select',
      '#title' => t('List type'),
      '#options' => array(
        'ul' => t('Unordered'),
        'ol' => t('Ordered'),
      ),
      '#default_value' => $handler->options['list']['type'],
      '#dependency' => array(
        'edit-options-list-mode' => array(
          'list',
        ),
      ),
    );
  }
  $form['link_to_entity'] = array(
    '#type' => 'checkbox',
    '#title' => t('Link this field to its entity'),
    '#description' => t("When using this, you should not set any other link on the field."),
    '#default_value' => $handler->options['link_to_entity'],
  );
}