Skip to content
Snippets Groups Projects
Commit f8a82ab9 authored by Hervé Donner's avatar Hervé Donner
Browse files

ISAICP-8664: Rename type > feed_type var in github_feed theme hook.

We can't use "#type" to pass vars in render arrays, it is reserved to render RenderElement's.
parent 0d4d6f4f
No related branches found
No related tags found
1 merge request!168Patch release v1.104.1
...@@ -15,7 +15,7 @@ function github_feed_theme(array $existing, string $type, string $theme, string ...@@ -15,7 +15,7 @@ function github_feed_theme(array $existing, string $type, string $theme, string
'github_feed' => [ 'github_feed' => [
'variables' => [ 'variables' => [
'url' => NULL, 'url' => NULL,
'type' => NULL, 'feed_type' => NULL,
'items' => NULL, 'items' => NULL,
], ],
], ],
...@@ -52,7 +52,7 @@ function github_feed_theme(array $existing, string $type, string $theme, string ...@@ -52,7 +52,7 @@ function github_feed_theme(array $existing, string $type, string $theme, string
* Implements template_preprocess_HOOK(). * Implements template_preprocess_HOOK().
*/ */
function template_preprocess_github_feed(array &$variables): void { function template_preprocess_github_feed(array &$variables): void {
switch ($variables['type']) { switch ($variables['feed_type']) {
case 'issue': case 'issue':
$variables['type_parsed'] = t('Issues'); $variables['type_parsed'] = t('Issues');
$variables['icon_id'] = 'info-circle'; $variables['icon_id'] = 'info-circle';
......
...@@ -90,7 +90,7 @@ public function viewElements(FieldItemListInterface $items, $langcode): array { ...@@ -90,7 +90,7 @@ public function viewElements(FieldItemListInterface $items, $langcode): array {
$element[$delta] = [ $element[$delta] = [
'#theme' => 'github_feed', '#theme' => 'github_feed',
'#url' => $item->repository, '#url' => $item->repository,
'#type' => $item->type, '#feed_type' => $item->type,
'#cache' => [ '#cache' => [
'max-age' => $this->getFieldSetting('cache_max_age'), 'max-age' => $this->getFieldSetting('cache_max_age'),
], ],
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Variables: * Variables:
* - items: The feed object. * - items: The feed object.
* - url: The url of the feed. * - url: The url of the feed.
* - type: The type of the feed. * - feed_type: The type of the feed.
#} #}
<div class="github-feed"> <div class="github-feed">
<h3>{{ "Items of type"|t }} "{{ type_parsed }}" {{ "from"|t }} {{ url }}:</h3> <h3>{{ "Items of type"|t }} "{{ type_parsed }}" {{ "from"|t }} {{ url }}:</h3>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Variables: * Variables:
* - items: The feed object. * - items: The feed object.
* - url: The url of the feed. * - url: The url of the feed.
* - type: The type of the feed. * - feed_type: The type of the feed.
#} #}
<div class="github-feed mb-4"> <div class="github-feed mb-4">
<h4 class="mb-3"> <h4 class="mb-3">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment