You are here

function og_node_create_links_content_type_edit_form in Organic groups 7.2

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

Edit form.

File

plugins/content_types/node_create_links/node_create_links.inc, line 45

Code

function og_node_create_links_content_type_edit_form($form, &$form_state) {
  $conf = $form_state['conf'];
  $options = array();
  foreach (field_info_fields() as $field_name => $field) {
    if (!og_is_group_audience_field($field_name)) {
      continue;
    }
    if ($field['settings']['target_type'] != 'node') {
      continue;
    }

    // Use CTools to get the best matching field name.
    ctools_include('fields');
    $options[$field_name] = ctools_field_label($field_name) . " ({$field_name})";
  }
  $form['field_name'] = array(
    '#title' => t('Field name'),
    '#type' => 'select',
    '#options' => $options,
    '#default_value' => $conf['field_name'],
    '#description' => t('The group audience field to prepopulate.'),
    '#required' => TRUE,
  );
  $options = array();
  foreach (node_type_get_types() as $type) {
    if (og_is_group_content_type('node', $type->type)) {
      $options[$type->type] = check_plain($type->name);
    }
  }
  $form['types'] = array(
    '#title' => t('Restrict to content types'),
    '#type' => 'checkboxes',
    '#options' => $options,
    '#default_value' => $conf['types'],
    '#description' => t('If left empty, all possible content types are shown.'),
  );
  return $form;
}