You are here

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

Contains pm_project.module.

File

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

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

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

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

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

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