This repository has been archived on 2022-07-12. You can view files and clone it, but cannot push or open issues or pull requests.
opencase/modules/zencrm_entities/zencrm_entities.module

62 lines
1.5 KiB
Plaintext
Raw Normal View History

<?php
/**
* @file
* Contains zencrm_entities.module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function zencrm_entities_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the zencrm_entities module.
case 'help.page.zencrm_entities':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Zen CRM Entities') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_theme().
*/
function zencrm_entities_theme() {
2018-04-05 18:05:00 +00:00
$theme = [];
$theme['zencrm_entities'] = [
'render element' => 'children',
];
2018-04-05 18:05:00 +00:00
$theme['profile'] = [
'render element' => 'elements',
'file' => 'profile.page.inc',
'template' => 'profile',
];
$theme['profile_content_add_list'] = [
'render element' => 'content',
'variables' => ['content' => NULL],
'file' => 'profile.page.inc',
];
return $theme;
}
/**
* Implements hook_theme_suggestions_HOOK().
*/
function zencrm_entities_theme_suggestions_profile(array $variables) {
$suggestions = [];
$entity = $variables['elements']['#profile'];
$sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
$suggestions[] = 'profile__' . $sanitized_view_mode;
$suggestions[] = 'profile__' . $entity->bundle();
$suggestions[] = 'profile__' . $entity->bundle() . '__' . $sanitized_view_mode;
$suggestions[] = 'profile__' . $entity->id();
$suggestions[] = 'profile__' . $entity->id() . '__' . $sanitized_view_mode;
return $suggestions;
}