You are here

function paragraphs_pack_field_settings_form in Paragraphs pack 7

Implements hook_field_settings_form().

File

includes/paragraphs_pack.fields.inc, line 62
Implements custom fields: PP_FIELD_TYPE_VIEW_MODE.

Code

function paragraphs_pack_field_settings_form($field, $instance, $has_data) {
  $form = array();
  switch ($field['type']) {
    case PP_FIELD_TYPE_VIEW_MODE:
      $settings = $field['settings'];

      // Select the target entity type.
      $entity_type_options = array();
      foreach (entity_get_info() as $entity_type => $entity_info) {
        $entity_type_options[$entity_type] = $entity_info['label'];
      }
      $form['entity_type'] = array(
        '#type' => 'select',
        '#title' => t('Entity type'),
        '#options' => $entity_type_options,
        '#default_value' => $instance['settings']['entity_type'],
        '#required' => TRUE,
        '#description' => t('The entity type whose view modes are displayed.'),
        '#disabled' => $has_data,
        '#size' => 1,
      );
      break;
  }
  return $form;
}