You are here

calendar.module in Calendar 8.2

Contains calendar.module.

File

calendar.module
View source
<?php

/**
 * @file
 * Contains calendar.module.
 */
use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_help().
 */
function calendar_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.calendar':
      $output = '';
      $output .= '<h3>' . t('Introduction') . '</h3>';
      $output .= '<p>' . t('The V2 version of Calendar for D8 is a near complete rewrite of the Calendar module.
      This module essentially provides views plugins for style, argument, pager and (header) area.
      It uses default row plugins, e.g. fields or entities with view modes.') . '</p>';
      return $output;
  }
}

/**
 * Implements hook_theme().
 */
function calendar_theme($existing, $type, $theme, $path) {
  return [
    'calendar_year' => [
      'variables' => [
        'view' => NULL,
        'rows' => [],
        'options' => [],
      ],
    ],
    'calendar_month' => [
      'variables' => [
        'view' => NULL,
        'rows' => [],
        'options' => [],
      ],
    ],
    'calendar_mini_month' => [
      'variables' => [
        'view' => NULL,
        'rows' => [],
        'options' => [],
      ],
    ],
    'calendar_week' => [
      'variables' => [
        'view' => NULL,
        'rows' => [],
        'options' => [],
      ],
    ],
    'calendar_day' => [
      'variables' => [
        'view' => NULL,
        'rows' => [],
        'options' => [],
      ],
    ],
    'calendar_day_hour' => [
      'variables' => [
        'view' => NULL,
        'rows' => [],
        'options' => [],
      ],
    ],
    'calendar_pager' => [
      'variables' => [
        'parameters' => [],
        'items' => [],
        'exclude' => FALSE,
      ],
    ],
    'calendar_header' => [
      'variables' => [
        'view' => NULL,
        'options' => [],
        'title' => '',
        'empty' => FALSE,
        'granularity' => NULL,
      ],
    ],
  ];
}

/**
 * Implements hook_entity_base_field_info_alter().
 */
function calendar_entity_base_field_info_alter(&$fields, $entity_type) {
  if ($entity_type
    ->id() == 'node') {
    if (isset($fields['title'])) {
      $fields['title']
        ->setDisplayConfigurable('view', TRUE);
    }
  }
}