You are here

function calendar_views_plugins in Calendar 7

Same name and namespace in other branches
  1. 6.2 includes/calendar.views.inc \calendar_views_plugins()
  2. 7.3 includes/calendar.views.inc \calendar_views_plugins()
  3. 7.2 includes/calendar.views.inc \calendar_views_plugins()

Implementation of hook_views_plugins

File

includes/calendar.views.inc, line 69
Creates calendar displays of Views results.

Code

function calendar_views_plugins() {
  $views_path = drupal_get_path('module', 'views');
  $module_path = drupal_get_path('module', 'calendar');
  if (module_exists('calendar_multiday')) {
    $theme_path = drupal_get_path('module', 'calendar_multiday');
    module_load_include('inc', 'calendar_multiday', 'theme/theme');
  }
  else {
    $theme_path = $module_path;
    module_load_include('inc', 'calendar', 'theme/theme');
  }
  $data = array(
    'module' => 'calendar',
    // This just tells our themes are elsewhere.
    'display' => array(
      // Main calendar display plugin.
      'calendar' => array(
        'title' => t('Calendar page'),
        'help' => t('Calendar page. Attach Calendar period attachments to this page, set to show the year, month, day, and week views.'),
        'handler' => 'calendar_plugin_display_page',
        'path' => "{$module_path}/includes",
        'parent' => 'page',
        'theme' => 'views_view',
        'no ui' => TRUE,
        'no remove' => TRUE,
        'uses hook menu' => TRUE,
        'uses hook block' => FALSE,
        'use ajax' => TRUE,
        'use pager' => FALSE,
        'accept attachments' => TRUE,
        'admin' => t('Calendar page'),
        'help topic' => 'getting-started',
        'js' => array(
          'misc/farbtastic/farbtastic.js',
          $module_path . '/js/calendar_colorpicker.js',
        ),
      ),
      // Calendar block display plugin.
      'calendar_block' => array(
        'title' => t('Calendar block'),
        'help' => t('Calendar page. Attach a Calendar period attachment to this block, set to show the year, month, day, or week view.'),
        'handler' => 'calendar_plugin_display_block',
        'path' => "{$module_path}/includes",
        'parent' => 'block',
        'theme' => 'views_view',
        'no ui' => TRUE,
        'no remove' => TRUE,
        'uses hook block' => TRUE,
        'use ajax' => TRUE,
        'use pager' => FALSE,
        'use more' => TRUE,
        'accept attachments' => TRUE,
        'admin' => t('Calendar block'),
        'help topic' => 'getting-started',
      ),
      // Display plugins for calendar displays.
      'calendar_period' => array(
        'title' => t('Calendar period'),
        'help' => t('An attachment for a Year, Month, Day, or Week calendar display, using any style you choose. Attach to a Calendar page and/or a Calendar block.'),
        'handler' => 'calendar_plugin_display_attachment',
        'path' => "{$module_path}/includes",
        'parent' => 'attachment',
        'theme' => 'views_view',
        'no ui' => TRUE,
        'no remove' => TRUE,
        'use ajax' => TRUE,
        'use pager' => TRUE,
        'admin' => t('Calendar page year, month, week, or day view'),
        'help topic' => 'getting-started',
      ),
    ),
    'style' => array(
      'parent' => array(
        // this isn't really a display but is necessary so the file can
        // be included.
        'no ui' => TRUE,
        'handler' => 'views_plugin_style',
        'path' => "{$views_path}/plugins",
        'parent' => '',
      ),
      // Style plugin for the navigation.
      'calendar_nav' => array(
        'title' => t('Calendar navigation'),
        'help' => t('Creates back/next navigation and calendar links.'),
        'handler' => 'calendar_plugin_style',
        'path' => "{$module_path}/includes",
        'parent' => 'parent',
        'theme' => 'calendar_main',
        'theme file' => 'theme.inc',
        'theme path' => "{$theme_path}/theme",
        'uses row plugin' => FALSE,
        'uses fields' => TRUE,
        'uses options' => FALSE,
        'type' => 'calendar',
        // Only used on calendar page or block displays.
        'even empty' => TRUE,
      ),
      'calendar_style' => array(
        'title' => t('Calendar'),
        'help' => t('Displays Views results in a calendar.'),
        'handler' => 'calendar_view_plugin_style',
        'path' => "{$module_path}/includes",
        'parent' => 'calendar_nav',
        'theme' => 'calendar_month',
        'theme file' => 'theme.inc',
        'theme path' => "{$theme_path}/theme",
        'additional themes' => array(
          'calendar_year' => 'style',
          'calendar_day' => 'style',
          'calendar_week' => 'style',
          'calendar_mini' => 'style',
        ),
        'uses row plugin' => FALSE,
        'uses fields' => TRUE,
        'uses options' => TRUE,
        'type' => 'normal',
        'even empty' => TRUE,
      ),
    ),
  );
  if (module_exists('calendar_multiday')) {
    $data['style']['calendar_style']['additional themes'] += array(
      'calendar_day_overlap' => 'style',
      'calendar_week_overlap' => 'style',
    );
  }
  return $data;
}