From 103a2172e37d84fc3775d8c1644619708c39a370 Mon Sep 17 00:00:00 2001 From: NiclasNorin <103985736+NiclasNorin@users.noreply.github.com> Date: Fri, 10 Nov 2023 09:48:18 +0100 Subject: [PATCH] feat: xfn link component (#351) --- source/php/Component/Link/Link.php | 5 +++++ source/php/Component/Link/link.json | 6 ++++-- source/php/Component/Nav/style/default.blade.php | 1 + source/php/Component/Nav/style/tiles.blade.php | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/source/php/Component/Link/Link.php b/source/php/Component/Link/Link.php index 5ddb40e5..54a77631 100644 --- a/source/php/Component/Link/Link.php +++ b/source/php/Component/Link/Link.php @@ -19,5 +19,10 @@ public function init() if ($target) { $this->data['attributeList']['target'] = $target; } + + //XFN + if ($xfn) { + $this->data['attributeList']['rel'] = $xfn; + } } } diff --git a/source/php/Component/Link/link.json b/source/php/Component/Link/link.json index b34783dc..8ac1d7f3 100644 --- a/source/php/Component/Link/link.json +++ b/source/php/Component/Link/link.json @@ -6,14 +6,16 @@ "href": "", "target": "_top", "keepContent": true, - "keepWrapper": true + "keepWrapper": true, + "xfn": false }, "description": { "slot": "The content of the link", "href": "Where should the link go to?", "target": "Link target attribute. Default is _top. Allowed values are _blank, _self, _parent or _top.", "keepContent": "If link is empty, should we show content anyways? Prints the content wrazpped by a span element.", - "keepWrapper": "If link is empty and keepContent is true, should we keep the span added by keepContent? If false, it will print the content without any wrapping element." + "keepWrapper": "If link is empty and keepContent is true, should we keep the span added by keepContent? If false, it will print the content without any wrapping element.", + "xfn": "Relation to the link (ex. nofollow)" }, "view": "link.blade.php", "dependency": { diff --git a/source/php/Component/Nav/style/default.blade.php b/source/php/Component/Nav/style/default.blade.php index 36572b06..5b8401a6 100644 --- a/source/php/Component/Nav/style/default.blade.php +++ b/source/php/Component/Nav/style/default.blade.php @@ -3,6 +3,7 @@ 'id' => $id . '-' . $item['id'] . '-' . $loop->index . '__label', 'classList' => [$baseClass . '__link'], 'href' => $item['href'], + 'xfn' => $item['xfn'] ?? false ]) @icon([ 'icon' => $item['icon']['icon'] ?? null, diff --git a/source/php/Component/Nav/style/tiles.blade.php b/source/php/Component/Nav/style/tiles.blade.php index 76184654..58bed880 100644 --- a/source/php/Component/Nav/style/tiles.blade.php +++ b/source/php/Component/Nav/style/tiles.blade.php @@ -7,6 +7,7 @@ 'u-margin__bottom--1' ], 'href' => $item['href'], + 'xfn' => $item['xfn'], ]) @icon($item['icon'])@endicon {{$item['label']}}