You are here

pm_board.module in Drupal PM (Project Management) 4.x

Contains pm_board.module.

File

modules/pm_board/pm_board.module
View source
<?php

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

/**
 * Implements hook_help().
 */
function pm_board_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {

    // Main module help for the pm_board module.
    case 'help.page.pm_board':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('PM Board') . '</p>';
      return $output;
    default:
  }
}

/**
 * Implements hook_theme().
 */
function pm_board_theme() {
  $theme = [];
  $theme['pm_board'] = [
    'render element' => 'elements',
    'file' => 'pm_board.page.inc',
    'template' => 'pm_board',
  ];
  $theme['pm_board_content_add_list'] = [
    'render element' => 'content',
    'variables' => [
      'content' => NULL,
    ],
    'file' => 'pm_board.page.inc',
  ];
  return $theme;
}

/**
 * Implements hook_theme_suggestions_HOOK().
 */
function pm_board_theme_suggestions_pm_board(array $variables) {
  $suggestions = [];
  $entity = $variables['elements']['#pm_board'];
  $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
  $suggestions[] = 'pm_board__' . $sanitized_view_mode;
  $suggestions[] = 'pm_board__' . $entity
    ->bundle();
  $suggestions[] = 'pm_board__' . $entity
    ->bundle() . '__' . $sanitized_view_mode;
  $suggestions[] = 'pm_board__' . $entity
    ->id();
  $suggestions[] = 'pm_board__' . $entity
    ->id() . '__' . $sanitized_view_mode;
  return $suggestions;
}