You are here

class calendar_plugin_display_block in Calendar 6.2

Same name and namespace in other branches
  1. 7 includes/calendar_plugin_display_block.inc \calendar_plugin_display_block
  2. 7.2 includes/calendar_plugin_display_block.inc \calendar_plugin_display_block

The plugin that handles a calendar block.

The only style option that will be available is the calendar style, which creates the navigation and links to other calendar displays. All options for paging, row plugins, etc. are deferred to the attachments.

Hierarchy

Expanded class hierarchy of calendar_plugin_display_block

1 string reference to 'calendar_plugin_display_block'
calendar_views_plugins in includes/calendar.views.inc
Implementation of hook_views_plugins

File

includes/calendar_plugin_display_block.inc, line 10

View source
class calendar_plugin_display_block extends views_plugin_display_block {
  function init(&$view, &$display, $options = NULL) {
    parent::init($view, $display, $options);
  }

  /**
   * Display validation.
   */
  function validate() {
    $errors = parent::validate();
    $arguments = $this->display->handler
      ->get_option('arguments');
    if (!in_array('date_argument', array_keys($arguments))) {
      if (empty($this->view->date_info->arg_missing)) {
        $errors[] = t("The Calendar period display '@display_title' will not work without a Date argument.", array(
          '@display_title' => $this->definition['title'],
        ));
      }
      $this->view->date_info->arg_missing = TRUE;
    }
    elseif ($arguments['date_argument']['default_action'] != 'default' || $arguments['date_argument']['default_argument_type'] != 'date') {
      if (empty($this->view->date_info->arg_missing_default)) {
        $errors[] = calendar_errors('missing_argument_default');
      }
      $this->view->date_info->arg_missing_default = TRUE;
    }
    return $errors;
  }
  function get_style_type() {
    return 'calendar';
  }
  function defaultable_sections($section = NULL) {
    if (in_array($section, array(
      'style_plugin',
      'row_options',
      'row_plugin',
      'items_per_page',
    ))) {
      return FALSE;
    }
    return parent::defaultable_sections($section);
  }

  /**
   * Override some of the parent options.
   */
  function options(&$display) {
    parent::options($display);
    $display['style_plugin'] = 'calendar_nav';
    $display['items_per_page'] = 0;
    $display['row_plugin'] = '';
    $display['defaults']['style_plugin'] = FALSE;
    $display['defaults']['style_options'] = FALSE;
    $display['defaults']['items_per_page'] = FALSE;
    $display['defaults']['row_plugin'] = FALSE;
    $display['defaults']['row_options'] = FALSE;
  }

  /**
   * The display block handler returns the structure necessary for a block.
   *
   * TODO This can be removed when the patch at http://drupal.org/node/290328
   * gets into an official release.
   */
  function execute() {

    // Prior to this being called, the $view should already be set to this
    // display, and arguments should be set on the view.
    $info['content'] = $this->view
      ->render();
    $info['subject'] = filter_xss_admin($this->view
      ->get_title());
    if (!empty($this->view->result) || $this
      ->get_option('empty') || !empty($this->view->style_plugin->definition['even empty'])) {
      return $info;
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
calendar_plugin_display_block::defaultable_sections function
calendar_plugin_display_block::execute function The display block handler returns the structure necessary for a block.
calendar_plugin_display_block::get_style_type function
calendar_plugin_display_block::init function
calendar_plugin_display_block::options function Override some of the parent options.
calendar_plugin_display_block::validate function Display validation.