You are here

function tvi_taxonomy_admin_form in Taxonomy Views Integrator 6

Same name and namespace in other branches
  1. 7 includes/tvi.admin.inc \tvi_taxonomy_admin_form()

Form builder for the main TVI administration form.

This is added to both vocabulary and term edit forms.

See also

tvi_validate_handler().

tvi_submit_handler().

Related topics

2 calls to tvi_taxonomy_admin_form()
tvi_term_form in includes/tvi.admin.inc
Adds TVI administration form to the term edit page
tvi_vocab_form in includes/tvi.admin.inc
Adds TVI administration form to the vocabulary edit page

File

includes/tvi.admin.inc, line 101
TVI Administration Interface

Code

function tvi_taxonomy_admin_form(&$form, $settings) {
  $path = drupal_get_path('module', 'tvi');
  drupal_add_js("{$path}/tvi.js");
  drupal_add_css("{$path}/tvi.css");

  // Add validate and submit handlers
  $form['#validate'][] = 'tvi_validate_handler';
  $form['#submit'][] = 'tvi_submit_handler';

  // Form container
  $form['tvi'] = array(
    '#type' => 'fieldset',
    '#title' => t('View usage'),
    '#weight' => -1,
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#tree' => TRUE,
  );

  // Javascript warning message
  $message = t('This form is best used with Javascript enabled. Please enable your Javascript, then refresh this page.');
  $form['tvi']['javascript_message'] = array(
    '#type' => 'markup',
    '#value' => '<p class="javascript-warning">' . $message . '</p>',
  );
  $form['tvi']['is_default'] = array(
    '#type' => 'value',
    '#value' => $settings->is_default,
  );
  $form['tvi']['type'] = array(
    '#type' => 'value',
    '#value' => $settings->type,
  );
  $form['tvi']['xid'] = array(
    '#type' => 'value',
    '#value' => $settings->xid,
  );

  //  View selector
  $form['tvi']['view_name'] = array(
    '#id' => 'tvi-view-selector',
    '#type' => 'select',
    '#title' => t('Using the view'),
    '#default_value' => $settings->view_name ? $settings->view_name : NULL,
    '#options' => tvi_get_views(),
    '#description' => t('The view that you wish to use for this display'),
  );

  // Display selector
  $form['tvi']['display'] = array(
    '#id' => 'tvi-display-selector',
    '#type' => 'select',
    '#title' => t('View display'),
    '#default_value' => $settings->view_name ? $settings->view_name . ':' . $settings->display : NULL,
    '#options' => tvi_get_view_displays(),
    // Assume no Javascript
    '#description' => t('The view display you select from the option above will be used to render this taxonomy term. <b>NOTE:</b> Views defined for vocabulary are trumped by views for terms.'),
  );

  // Status toggle switch
  $form['tvi']['status'] = array(
    '#id' => 'tvi-status-check',
    '#type' => 'checkbox',
    '#title' => t('Use view override.'),
    '#default_value' => $settings->status,
    '#description' => t('Unchecking this field will disable the use of the view when displaying this taxonomy page.'),
  );
  $form['tvi']['description_enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display term description'),
    '#default_value' => $settings->description_enabled,
    '#description' => t('When enabled, the term description is displayed before the rendered view on term page.'),
  );
}