You are here

function web_widgets_plugin_display_web_widgets::options_summary 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_summary()

Provide the summary for page options in the views UI.

This output is returned as an array.

Overrides views_plugin_display_page::options_summary

File

views/web_widgets_plugin_display_web_widgets.inc, line 181
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_summary(&$categories, &$options) {

  // It is very important to call the parent function here:
  parent::options_summary($categories, $options);

  // I don't think we want to give feeds menus directly.
  unset($options['menu']);
  $displays = array_filter($this
    ->get_option('displays'));
  if (count($displays) > 1) {
    $attach_to = t('Multiple displays');
  }
  else {
    if (count($displays) == 1) {
      $display = array_shift($displays);
      if (!empty($this->view->display[$display])) {
        $attach_to = $this->view->display[$display]->display_title;
      }
    }
  }
  if (!isset($attach_to)) {
    $attach_to = t('None');
  }
  $options['displays'] = array(
    'category' => 'page',
    'title' => t('Attach embed code to'),
    'value' => $attach_to,
  );
  $x = $this
    ->get_option('width');
  $y = $this
    ->get_option('height');
  if (!empty($x) && !empty($y)) {
    $dim = t("X: !x Y: !y", array(
      '!x' => $x,
      '!y' => $y,
    ));
  }
  else {
    $dim = t('Not set yet');
  }
  $options['dimension'] = array(
    'category' => 'page',
    'title' => t('Widget dimensions'),
    'value' => $dim,
  );
  $current_style = $this
    ->get_option('embed_style');

  // iframe is the default, built-in style, always available
  $current_style = empty($current_style) ? 'iframe' : $current_style;
  $style_names = web_widgets_get_styles();
  $options['embed_style'] = array(
    'category' => 'page',
    'title' => t('Embed style'),
    'value' => $style_names[$current_style],
  );
  $track = $this
    ->get_option('track');
  $track = empty($track) ? t('Tracking is turned off') : $track;
  $options['track'] = array(
    'category' => 'page',
    'title' => t('Google Tracking code'),
    'value' => $track,
  );
}