Rename and re-organise custom modules
- Rename `opd_talks` to `opdavies_talks` - Rename `custom` to `opdavies_blog`
This commit is contained in:
parent
e4e898f22c
commit
9b1a8fb3be
53 changed files with 125 additions and 116 deletions
28
web/modules/custom/opdavies_blog/hooks/node_links/alter.inc
Normal file
28
web/modules/custom/opdavies_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(),
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue