You are here

Model.php in Calendar Systems 8.2

This is where the module integrates with Drupal

Contains \Drupal\calendar_systems.

File

src/Model.php
View source
<?php

/**
 * This is where the module integrates with Drupal
 * @file
 * Contains \Drupal\calendar_systems.
 */
namespace Drupal\calendar_systems;

class Model {

  /**
   * Implementation of hook_help()
   * @param $route_name
   * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
   * @return string
   */
  public static function hook_help($route_name, \Drupal\Core\Routing\RouteMatchInterface $route_match) {
    switch ($route_name) {
      case 'help.page.calendar_systems':
        $text = file_get_contents(__DIR__ . '/README.md');
        if (!\Drupal::moduleHandler()
          ->moduleExists('markdown')) {
          return '<pre>' . $text . '</pre>';
        }
        else {

          // Use the Markdown filter to render the README.
          $filter_manager = \Drupal::service('plugin.manager.filter');
          $settings = \Drupal::configFactory()
            ->get('markdown.settings')
            ->getRawData();
          $config = [
            'settings' => $settings,
          ];
          $filter = $filter_manager
            ->createInstance('markdown', $config);
          return $filter
            ->process($text, 'en');
        }
      case 'calendar_systems.admin':
        $output = '<p>' . t('Using the following form you can assign a different calendar system to each language and also select the default calendar system.') . '</p>';
        return $output;
    }
  }

  /**
   * Implementation of hook_patch() of patch_manager module
   * @return array
   */
  public static function hook_patch() {
    $patches = array();
    $patches[] = array(
      'title' => t('Allows drupal format_date function to be altered by other modules'),
      'patch' => 'patch/core_format_date_alter.patch',
      'module' => 'core',
      'issue' => '1178342',
      'description' => t('Allows drupal format_date function to be altered by other modules'),
      'patchdir' => '',
    );
    return $patches;
  }

}

Classes

Namesort descending Description
Model