You are here

class Model in Calendar Systems 8.2

Hierarchy

  • class \Drupal\calendar_systems\Model

Expanded class hierarchy of Model

File

src/Model.php, line 10
This is where the module integrates with Drupal

Namespace

Drupal\calendar_systems
View source
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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Model::hook_help public static function Implementation of hook_help()
Model::hook_patch public static function Implementation of hook_patch() of patch_manager module