From 53a573f71ba33ca5903f88b85eaa96ce3e1eefad Mon Sep 17 00:00:00 2001 From: Mark Conroy Date: Mon, 1 Dec 2025 12:10:37 +0000 Subject: [PATCH 1/2] adds unpublished items to linkit --- .../linkit.linkit_profile.default.yml | 3 +- src/Plugin/Linkit/Matcher/EntityMatcher.php | 34 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/Plugin/Linkit/Matcher/EntityMatcher.php diff --git a/modules/localgov_media/config/optional/linkit.linkit_profile.default.yml b/modules/localgov_media/config/optional/linkit.linkit_profile.default.yml index bf07d35..62f7471 100644 --- a/modules/localgov_media/config/optional/linkit.linkit_profile.default.yml +++ b/modules/localgov_media/config/optional/linkit.linkit_profile.default.yml @@ -2,6 +2,7 @@ langcode: en status: true dependencies: module: + - localgov_core - node - paragraphs_library label: Default @@ -17,7 +18,7 @@ matchers: group_by_bundle: true substitution_type: canonical limit: 100 - include_unpublished: false + include_unpublished: true weight: -10 c3257417-fce9-4307-8251-58672edf88be: id: email diff --git a/src/Plugin/Linkit/Matcher/EntityMatcher.php b/src/Plugin/Linkit/Matcher/EntityMatcher.php new file mode 100644 index 0000000..d3db8f4 --- /dev/null +++ b/src/Plugin/Linkit/Matcher/EntityMatcher.php @@ -0,0 +1,34 @@ +label()); + + // Prepend "Unpublished: " for unpublished entities. + if (method_exists($entity, 'isPublished') && !$entity->isPublished()) { + $label = 'Unpublished: ' . $label; + } + + return $label; + } + +} From f02058d276ed6dabb068e40f084210190fa878bc Mon Sep 17 00:00:00 2001 From: Mark Conroy Date: Mon, 1 Dec 2025 12:16:29 +0000 Subject: [PATCH 2/2] adds NodeMatcher --- src/Plugin/Linkit/Matcher/NodeMatcher.php | 35 +++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/Plugin/Linkit/Matcher/NodeMatcher.php diff --git a/src/Plugin/Linkit/Matcher/NodeMatcher.php b/src/Plugin/Linkit/Matcher/NodeMatcher.php new file mode 100644 index 0000000..4b1930d --- /dev/null +++ b/src/Plugin/Linkit/Matcher/NodeMatcher.php @@ -0,0 +1,35 @@ +label()); + + // Prepend "Unpublished: " for unpublished nodes. + if (method_exists($entity, 'isPublished') && !$entity->isPublished()) { + $label = 'Unpublished: ' . $label; + } + + return $label; + } + +}