You are here

function party_attached_entity_content_type_options in Party 8.2

Same name and namespace in other branches
  1. 7 plugins/content_types/attached_entity/attached_entity.inc \party_attached_entity_content_type_options()

Returns an edit form for custom type settings.

1 string reference to 'party_attached_entity_content_type_options'
party_attached_entity_content_type_content_types in plugins/content_types/attached_entity/attached_entity.inc
Return all attached entity content types available

File

plugins/content_types/attached_entity/attached_entity.inc, line 133
Plugin to handle attached entity content types

Code

function party_attached_entity_content_type_options($form, &$form_state) {
  $conf = $form_state['conf'];
  $subtype = $form_state['subtype_name'];
  $data_set_name = $subtype;
  $data_set = party_get_data_set_info($data_set_name);
  $delta_options = array();
  $delta_options['-1'] = 'Show All';
  for ($i = 0; $i < 20; $i++) {
    $delta_options["{$i}"] = "{$i}";
  }
  $form['delta'] = array(
    '#title' => t('Attached Entity Delta'),
    '#description' => t('If more than one attached entity of this type is present, which one should we pick?'),
    '#type' => 'select',
    '#options' => $delta_options,
    '#default_value' => $conf['delta'],
  );
  $entity = entity_get_info($data_set['entity type']);
  $view_mode_options = array();
  foreach ($entity['view modes'] as $mode => $option) {
    $view_mode_options[$mode] = $option['label'];
  }
  $form['view_mode'] = array(
    '#title' => t('View mode'),
    '#type' => 'select',
    '#description' => t('Select a view mode for this attached entity.'),
    '#options' => $view_mode_options,
    '#default_value' => $conf['view_mode'],
  );
  return $form;
}