You are here

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

File

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

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

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

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

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

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