You are here

function charts_plugin_display_chart::options_form in Charts 7.2

Provide the default form for setting options.

Overrides views_plugin_display::options_form

File

views/charts_plugin_display_chart.inc, line 84
Contains the Chart display type (similar to Page, Block, Attachment, etc.)

Class

charts_plugin_display_chart
Display plugin to attach multiple chart configurations to the same chart.

Code

function options_form(&$form, &$form_state) {

  // It is very important to call the parent function here:
  parent::options_form($form, $form_state);
  switch ($form_state['section']) {
    case 'parent_display':
      $form['#title'] .= t('Parent display');

      // Filter down the list of displays to include only those that use
      // the chart display style.
      $display_options = array();
      foreach ($this->view->display as $display_name => $display) {
        if ($display->handler
          ->get_option('style_plugin') === 'chart' && $display_name !== $this->view->current_display) {
          $display_options[$display_name] = $display->display_title;
        }
      }
      $form['parent_display'] = array(
        '#title' => t('Parent display'),
        '#type' => 'select',
        '#options' => $display_options,
        '#empty_option' => t('- None - '),
        '#required' => TRUE,
        '#default_value' => $this
          ->get_option('parent_display'),
        '#description' => t('Select a parent display onto which this chart will be overlaid. Only other displays using a "Chart" format are included here. This option may be used to create charts with several series of data or to create combination charts.'),
      );
      break;
    case 'inherit_yaxis':
      $form['#title'] .= t('Axis settings');
      $form['inherit_yaxis'] = array(
        '#title' => t('Y-Axis settings'),
        '#type' => 'radios',
        '#options' => array(
          1 => t('Inherit primary of parent display'),
          0 => t('Create a secondary axis'),
        ),
        '#default_value' => $this
          ->get_option('inherit_yaxis'),
        '#description' => t('In most charts, the X and Y axis from the parent display are both shared with each attached child chart. However, if this chart is going to use a different unit of measurement, a secondary axis may be added on the opposite side of the normal Y-axis.'),
      );
      break;
    case 'inherit_arguments':
      $form['#title'] .= t('Inherit contextual filters');
      $form['inherit_arguments'] = array(
        '#type' => 'checkbox',
        '#title' => t('Inherit'),
        '#description' => t('Should this display inherit its contextual filter values from the parent display to which it is attached?'),
        '#default_value' => $this
          ->get_option('inherit_arguments'),
      );
      break;
    case 'inherit_exposed_filters':
      $form['#title'] .= t('Inherit exposed filters');
      $form['inherit_exposed_filters'] = array(
        '#type' => 'checkbox',
        '#title' => t('Inherit'),
        '#description' => t('Should this display inherit its exposed filter values from the parent display to which it is attached?'),
        '#default_value' => $this
          ->get_option('inherit_exposed_filters'),
      );
      break;
  }
}