You are here

function hashtags_configuration_form in Hashtags 7.2

Same name and namespace in other branches
  1. 7 hashtags.module \hashtags_configuration_form()

Hashtags configuration form

1 string reference to 'hashtags_configuration_form'
hashtags_menu in ./hashtags.module
Implements hook_menu.

File

./hashtags.module, line 252

Code

function hashtags_configuration_form($form, &$form_state) {
  $form['hashtags_output_type'] = array(
    '#type' => 'select',
    '#title' => t('Format type'),
    '#description' => t('How tags/hashtags will be shown'),
    '#default_value' => variable_get('hashtags_output_type', 2),
    '#options' => array(
      HASHTAGS_ALL_TAGS_AS_LINKS => t('tags/hashtags as links'),
      HASHTAGS_ONLY_HASHTAGS_AS_LINKS => t('only hashtags as links'),
      HASHTAGS_ALL_TAGS_AS_PLAIN_TEXT => t('tags/hashtags as plain text'),
    ),
  );
  $form['hashtags_show_taxonomy_field'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show tag field'),
    '#default_value' => variable_get('hashtags_show_taxonomy_field', 1),
    '#description' => t('Show a taxonomy field on node add/edit form'),
  );
  $field_name = variable_get('hashtags_terms_field', '');
  $form['hashtags_terms_field'] = array(
    '#type' => 'textfield',
    '#title' => t('Hashtags terms field'),
    '#default_value' => $field_name,
    '#required' => TRUE,
    '#disabled' => TRUE,
  );
  $types = node_type_get_names();

  //dsm($types);
  $types_keys = array_keys($types);
  $default_values = array();
  $vocabulary = taxonomy_vocabulary_load(variable_get('hashtags_vocabulary', 0));
  foreach ($types_keys as $type) {
    if (field_info_instance('node', $field_name, $type)) {
      $default_values[$type] = $type;
    }
    else {
      $default_values[$type] = 0;
    }
  }
  $values = array();
  $form['hashtags_content_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Content types'),
    '#options' => $types,
    '#default_value' => $default_values,
  );
  $form['#submit'][] = 'hashtags_configuration_form_content_type_settings_submit';
  return system_settings_form($form);
}