You are here

function views_rss_handler_field_term_node_tid::options_form in Views RSS 7.2

Same name and namespace in other branches
  1. 6.2 views/views_rss_handler_field_term_node_tid.inc \views_rss_handler_field_term_node_tid::options_form()

Provide "link to term" option.

Overrides views_handler_field_term_node_tid::options_form

File

views/views_rss_handler_field_term_node_tid.inc, line 18
Field handler to provide additional control for the All Taxonomy Terms field.

Class

views_rss_handler_field_term_node_tid
@file Field handler to provide additional control for the All Taxonomy Terms field.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);

  // New display type: "RSS <category> element".
  $form['type']['#weight'] = 2;
  $form['separator']['#weight'] = 3;
  $form['type']['#options']['rss_category'] = t('RSS &lt;category&gt; element');

  // Additional options for "domain" attribute.
  $form['rss_domain'] = array(
    '#type' => 'select',
    '#title' => t('<em>Domain</em> attribute'),
    '#description' => t("<em>domain</em> attribute identifies the category's taxonomy.") . ' ' . l('[?]', 'http://www.rssboard.org/rss-profile#element-channel-item-category', array(
      'attributes' => array(
        'title' => t('Need more information?'),
      ),
    )),
    '#options' => array(
      'none' => t('None'),
      'path' => t('Path'),
      'alias' => t('URL alias'),
    ),
    '#default_value' => $this->options['rss_domain'],
    '#dependency' => array(
      'radio:options[type]' => array(
        'rss_category',
      ),
    ),
    '#weight' => 3,
  );

  // Output terms with their parents.
  // Example: parent2/parent1/term
  $form['rss_include_parents'] = array(
    '#type' => 'checkbox',
    '#title' => t('Include term parents'),
    '#description' => t('Output terms from hierarchical vocabularies together with their parents (slash-delimited).'),
    '#default_value' => $this->options['rss_include_parents'],
    '#dependency' => array(
      'radio:options[type]' => array(
        'rss_category',
      ),
    ),
    '#weight' => 4,
  );

  // Output terms with their parents and vocabulary.
  // Example: vocabulary/parent2/parent1/term
  $form['rss_include_vocabulary'] = array(
    '#type' => 'checkbox',
    '#title' => t('Include term vocabulary'),
    '#description' => t('Add vocabulary name before term parents.'),
    '#default_value' => $this->options['rss_include_vocabulary'],
    '#process' => array(
      'ctools_dependent_process',
    ),
    '#dependency_count' => 2,
    '#dependency' => array(
      'radio:options[type]' => array(
        'rss_category',
      ),
      'edit-options-rss-include-parents' => array(
        1,
      ),
    ),
    '#weight' => 5,
  );

  // Hide "Link this field to its term page" checkbox
  // if "RSS <category> element" is selected as "Display type".
  $form['link_to_taxonomy']['#weight'] = 4;
  $form['link_to_taxonomy']['#states'] = array(
    'visible' => array(
      ':input[name="options[type]"]' => array(
        '!value' => 'rss_category',
      ),
    ),
  );
}