You are here

function calendar_plugin_display_attachment::attach_to in Calendar 7

Same name and namespace in other branches
  1. 6.2 includes/calendar_plugin_display_attachment.inc \calendar_plugin_display_attachment::attach_to()
  2. 7.2 includes/calendar_plugin_display_attachment.inc \calendar_plugin_display_attachment::attach_to()

Attach only the appropriate displays for the current argument.

Overrides views_plugin_display_attachment::attach_to

File

includes/calendar_plugin_display_attachment.inc, line 118
Views display plugin for the Calendar module.

Class

calendar_plugin_display_attachment
The plugin that handles calendar attachment displays.

Code

function attach_to($display_id) {
  $display_granularity = $this
    ->calendar_type();
  $view_granularity = $this
    ->display_granularity($display_id);

  // If this is not the right display to show,
  // don't attach it, just exit.
  if ($view_granularity != $display_granularity) {
    unset($this->display);
    return;
  }
  $this->view->date_info->parent_id = $display_id;

  // See if we're attaching to a block rather than a page.
  if (substr($display_id, 0, 14) == 'calendar_block') {
    $this->view->date_info->mini = TRUE;
    $this->view->date_info->block = TRUE;
    $this->view->date_info->calendar_popup = FALSE;
    if (!isset($this->view->date_info->block_identifier)) {
      $this->view->date_info->block_identifier = 'mini';
    }
  }
  elseif (substr($display_id, 0, 9) == 'calendar_') {
    $this->view->date_info->calendar_colors = $this->view->display[$display_id]->handler->options['calendar_colors'];
    $this->view->date_info->calendar_colors_taxonomy = $this->view->display[$display_id]->handler->options['calendar_colors_taxonomy'];
    $this->view->date_info->calendar_colors_group = $this->view->display[$display_id]->handler->options['calendar_colors_group'];
    $this->view->date_info->calendar_popup = $this->view->display[$display_id]->handler->options['calendar_popup'];
    $this->view->date_info->calendar_date_link = $this->view->display[$display_id]->handler->options['calendar_date_link'];
  }
  parent::attach_to($display_id);
}