You are here

function dynamic_entity_reference_field_settings_form in Dynamic Entity Reference 7

Implements hook_field_settings_form().

File

./dynamic_entity_reference.field.inc, line 377
Contains field hooks.

Code

function dynamic_entity_reference_field_settings_form($field, $instance, $has_data) {

  // 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'];
  }
  $element['exclude_entity_types'] = array(
    '#type' => 'checkbox',
    '#title' => t('Exclude the selected items'),
    '#default_value' => $field['settings']['exclude_entity_types'],
    '#disabled' => $has_data,
  );
  $element['entity_type_ids'] = array(
    '#type' => 'select',
    '#title' => t('Select items'),
    '#options' => $entity_type_options,
    '#default_value' => $field['settings']['entity_type_ids'],
    '#disabled' => $has_data,
    '#multiple' => TRUE,
  );
  return $element;
}