htools-8.x-1.x-dev/modules/htools_relations/htools_relations.module
modules/htools_relations/htools_relations.module
<?php
/**
* @file
* Contains htools_relations.module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function htools_relations_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the htools_relations module.
case 'help.page.htools_relations':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
return $output;
default:
}
}
/**
* Implements hook_theme().
*/
function htools_relations_theme() {
$theme = [];
$theme['relational_entity'] = [
'render element' => 'elements',
'file' => 'relational_entity.page.inc',
'template' => 'relational_entity',
];
$theme['relational_entity_content_add_list'] = [
'render element' => 'content',
'variables' => ['content' => NULL],
'file' => 'relational_entity.page.inc',
];
return $theme;
}
/**
* Implements hook_theme_suggestions_HOOK().
*/
function htools_relations_theme_suggestions_relational_entity(array $variables) {
$suggestions = [];
$entity = $variables['elements']['#relational_entity'];
$sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
$suggestions[] = 'relational_entity__' . $sanitized_view_mode;
$suggestions[] = 'relational_entity__' . $entity->bundle();
$suggestions[] = 'relational_entity__' . $entity->bundle() . '__' . $sanitized_view_mode;
$suggestions[] = 'relational_entity__' . $entity->id();
$suggestions[] = 'relational_entity__' . $entity->id() . '__' . $sanitized_view_mode;
return $suggestions;
}
