You are here

function web_widgets_plugin_display_web_widgets::options_form in Web Widgets 7

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

Provide the default form for setting options.

Overrides views_plugin_display_page::options_form

File

views/web_widgets_plugin_display_web_widgets.inc, line 103
Implementation of widget display.

Class

web_widgets_plugin_display_web_widgets
The plugin that handles a feed, such as RSS or atom.

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 'displays':
      $form['#title'] .= t('Attach embed code to');
      $displays = array();
      foreach ($this->view->display as $display_id => $display) {
        if (!empty($display->handler) && $display->handler
          ->accept_attachments()) {
          $displays[$display_id] = $display->display_title;
        }
      }
      $form['displays'] = array(
        '#type' => 'checkboxes',
        '#description' => t('The embed code will be displayed on the selected displays.'),
        '#options' => $displays,
        '#default_value' => $this
          ->get_option('displays'),
      );
      break;
    case 'dimension':
      $form['width'] = array(
        '#type' => 'textfield',
        '#description' => t('The width of the widget in pixels (not respected by all embed styles).'),
        '#default_value' => $this
          ->get_option('width'),
      );
      $form['height'] = array(
        '#type' => 'textfield',
        '#description' => t('The height of the widget in pixels (not respected by all embed styles).'),
        '#default_value' => $this
          ->get_option('height'),
      );
      break;
    case 'embed_style':
      $form['embed_style'] = array(
        '#type' => 'select',
        '#options' => web_widgets_get_styles(),
        '#description' => 'The method being used to embed a widget from this site in another site.',
        '#default_value' => $this
          ->get_option('embed_style'),
      );
      break;
    case 'path':
      $form['path']['#description'] = t('This view will be displayed by visiting this path on your site. It is recommended that the path be something like "path/%/%/widget" or "path/%/%/widget/[embed-style]", putting one % in the path for each argument you have defined in the view.');
      break;
    case 'track':
      $form['track'] = array(
        '#type' => 'textfield',
        '#default_value' => $this
          ->get_option('track'),
        '#description' => t('Supply a valid Analytics domain ID if you want to track the usage of the widget in the Google Analytics ecosystem. If the field is empty, the tracking is turned off.'),
      );
      break;
  }
}