You are here

function flot_fields_views_plugin_style::legendForm in Flot 7

1 call to flot_fields_views_plugin_style::legendForm()
flot_fields_views_plugin_style::options_form in flot_views/views/flot_fields_views_plugin_style.inc
Provide a form to edit options for this plugin.

File

flot_views/views/flot_fields_views_plugin_style.inc, line 230
Style plugin for views

Class

flot_fields_views_plugin_style
@file Style plugin for views

Code

function legendForm() {
  $form = array();
  $form['showlegend'] = array(
    '#type' => 'select',
    '#title' => t('Show legend'),
    '#options' => array(
      'yes' => t('Yes'),
      'no' => t('No'),
    ),
    '#description' => t("Do you want to show the legend."),
    '#default_value' => $this->options['showlegend'],
  );
  $form['legend'] = array(
    '#type' => 'fieldset',
    '#title' => t('Legend'),
    '#description' => t('Customize the legend'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#states' => array(
      'visible' => array(
        ':input[name="style_options[showlegend]"]' => array(
          'value' => 'yes',
        ),
      ),
    ),
  );
  $form['legend']['labelBoxBorderColor'] = array(
    '#type' => 'textfield',
    '#title' => t('Label box border color'),
    '#description' => t('Define the border color of the label boxes of the legend.'),
    '#default_value' => $this->options['legend']['labelBoxBorderColor'],
  );
  $form['legend']['noColumns'] = array(
    '#type' => 'textfield',
    '#title' => t('Columns'),
    '#description' => t('The number of columns to display the legend in.'),
    '#default_value' => $this->options['legend']['noColumns'],
  );
  $form['legend']['position'] = array(
    '#type' => 'select',
    '#title' => t('Position'),
    '#description' => t('Specifies the overall placement of the legend within the plot, select "bottom" to put the legend below the graph.'),
    '#options' => array(
      'ne' => t('North-East'),
      'nw' => t('North-West'),
      'se' => t('South-East'),
      'sw' => t('South-West'),
      'bottom' => t('Bottom (below the graph)'),
    ),
    '#default_value' => $this->options['legend']['position'],
  );
  $form['legend']['margin'] = array(
    '#type' => 'fieldset',
    '#title' => t('Margin'),
    '#description' => t('Customize the distance of the legend to the plot edge'),
    '#states' => array(
      'invisible' => array(
        ':input[name="style_options[legend][position]"]' => array(
          'value' => 'bottom',
        ),
      ),
    ),
  );
  $form['legend']['margin']['x'] = array(
    '#type' => 'textfield',
    '#title' => t('X margin'),
    '#default_value' => $this->options['legend']['margin']['x'],
  );
  $form['legend']['margin']['y'] = array(
    '#type' => 'textfield',
    '#title' => t('Y margin'),
    '#default_value' => $this->options['legend']['margin']['y'],
  );
  $form['legend']['backgroundColor'] = array(
    '#type' => 'textfield',
    '#title' => t('Background color'),
    '#description' => t('Specify the background color for the legend, leave empty for auto-detect.'),
    '#default_value' => $this->options['legend']['backgroundColor'],
    '#states' => array(
      'invisible' => array(
        ':input[name="style_options[legend][position]"]' => array(
          'value' => 'bottom',
        ),
      ),
    ),
  );
  $form['legend']['backgroundOpacity'] = array(
    '#type' => 'textfield',
    '#title' => t('Background opacity'),
    '#description' => t('The background opacity of the legend. A number between 1 and 0, use decimal point.'),
    '#default_value' => $this->options['legend']['backgroundOpacity'],
    '#states' => array(
      'invisible' => array(
        ':input[name="style_options[legend][position]"]' => array(
          'value' => 'bottom',
        ),
      ),
    ),
  );
  return $form;
}