Rename custom module directories
- Rename `opdavies_blog` to `blog`. - Rename `opdavies_blog_test` to `blog_test`. - Rename `opdavies_talks` to `talks`. - Rename `opdavies_talks_test` to `talks_test`. The files within the directories haven't changed, so there is no breaking change caused by renaming the directories. Please enter the commit message for your changes. Lines starting
This commit is contained in:
parent
d7d5a6c8a3
commit
cbe60209e6
59 changed files with 0 additions and 0 deletions
20
web/modules/custom/blog/hooks/entity_type/build.inc
Normal file
20
web/modules/custom/blog/hooks/entity_type/build.inc
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Entity type build hooks.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Drupal\discoverable_entity_bundle_classes\Storage\Node\NodeStorage;
|
||||
|
||||
/**
|
||||
* Implements hook_entity_type_build().
|
||||
*/
|
||||
function opdavies_blog_entity_type_build(array &$entityTypes): void {
|
||||
/** @var \Drupal\Core\Entity\EntityTypeInterface[] $entityTypes */
|
||||
if (isset($entityTypes['node'])) {
|
||||
$entityTypes['node']->setStorageClass(NodeStorage::class);
|
||||
}
|
||||
}
|
28
web/modules/custom/blog/hooks/node_links/alter.inc
Normal file
28
web/modules/custom/blog/hooks/node_links/alter.inc
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Node links alter hooks.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\node\NodeInterface;
|
||||
|
||||
/**
|
||||
* Implements hook_node_links_alter().
|
||||
*/
|
||||
function opdavies_blog_node_links_alter(array &$links, NodeInterface $node): void {
|
||||
if (!method_exists($node, 'getExternalLink')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($link = $node->getExternalLink()) {
|
||||
$links['node']['#links']['node-readmore']['url'] = Url::fromUri($link['uri']);
|
||||
$links['node']['#links']['node-readmore']['title'] = t('Read more<span class="visually-hidden"> about @title</span> (<span class="visually-hidden">on </span>@domain)', [
|
||||
'@domain' => $link['title'],
|
||||
'@title' => $node->label(),
|
||||
]);
|
||||
}
|
||||
}
|
18
web/modules/custom/blog/hooks/preprocess/block.inc
Normal file
18
web/modules/custom/blog/hooks/preprocess/block.inc
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Block preprocess hooks.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Implements hook_preprocess_HOOK().
|
||||
*/
|
||||
function opdavies_blog_preprocess_block(array &$variables): void {
|
||||
// Add the 'markup' class to blocks.
|
||||
if (in_array($variables['plugin_id'], ['views_block:featured_blog_posts-block_1'])) {
|
||||
$variables['attributes']['class'][] = 'markup';
|
||||
}
|
||||
}
|
21
web/modules/custom/blog/hooks/preprocess/node.inc
Normal file
21
web/modules/custom/blog/hooks/preprocess/node.inc
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Node preprocess functions.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Implements hook_preprocess_HOOK().
|
||||
*/
|
||||
function opdavies_blog_preprocess_node(array &$variables): void {
|
||||
if (!method_exists($variables['node'], 'getExternalLink')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($link = $variables['node']->getExternalLink()) {
|
||||
$variables['url'] = $link['uri'];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue