summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/taxonomy
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/taxonomy')
-rw-r--r--core/modules/taxonomy/src/Hook/TaxonomyThemeHooks.php25
-rw-r--r--core/modules/taxonomy/src/Hook/TaxonomyTokensHooks.php2
-rw-r--r--core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php2
-rw-r--r--core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php6
-rw-r--r--core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php2
-rw-r--r--core/modules/taxonomy/src/TermViewsData.php4
-rw-r--r--core/modules/taxonomy/taxonomy.module15
-rw-r--r--core/modules/taxonomy/tests/src/Functional/TermLanguageTest.php2
8 files changed, 34 insertions, 24 deletions
diff --git a/core/modules/taxonomy/src/Hook/TaxonomyThemeHooks.php b/core/modules/taxonomy/src/Hook/TaxonomyThemeHooks.php
new file mode 100644
index 00000000000..89f177daf24
--- /dev/null
+++ b/core/modules/taxonomy/src/Hook/TaxonomyThemeHooks.php
@@ -0,0 +1,25 @@
+<?php
+
+namespace Drupal\taxonomy\Hook;
+
+use Drupal\Core\Hook\Attribute\Hook;
+
+/**
+ * Hook implementations for taxonomy.
+ */
+class TaxonomyThemeHooks {
+
+ /**
+ * Implements hook_theme_suggestions_HOOK().
+ */
+ #[Hook('theme_suggestions_taxonomy_term')]
+ public function themeSuggestionsTaxonomyTerm(array $variables): array {
+ $suggestions = [];
+ /** @var \Drupal\taxonomy\TermInterface $term */
+ $term = $variables['elements']['#taxonomy_term'];
+ $suggestions[] = 'taxonomy_term__' . $term->bundle();
+ $suggestions[] = 'taxonomy_term__' . $term->id();
+ return $suggestions;
+ }
+
+}
diff --git a/core/modules/taxonomy/src/Hook/TaxonomyTokensHooks.php b/core/modules/taxonomy/src/Hook/TaxonomyTokensHooks.php
index 12c8f7dc885..7c7fbf63d98 100644
--- a/core/modules/taxonomy/src/Hook/TaxonomyTokensHooks.php
+++ b/core/modules/taxonomy/src/Hook/TaxonomyTokensHooks.php
@@ -65,7 +65,7 @@ class TaxonomyTokensHooks {
'name' => $this->t("Term count"),
'description' => $this->t("The number of terms belonging to the taxonomy vocabulary."),
];
- // Chained tokens for taxonomies
+ // Chained tokens for taxonomies.
$term['vocabulary'] = [
'name' => $this->t("Vocabulary"),
'description' => $this->t("The vocabulary the taxonomy term belongs to."),
diff --git a/core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php b/core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php
index 7b7a57363bc..f4fd0c8641f 100644
--- a/core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php
+++ b/core/modules/taxonomy/src/Plugin/views/argument_default/Tid.php
@@ -181,7 +181,7 @@ class Tid extends ArgumentDefaultPluginBase implements CacheableDependencyInterf
}
if (!empty($this->options['limit'])) {
$tids = [];
- // Filter by vocabulary
+ // Filter by vocabulary.
foreach ($taxonomy as $tid => $vocab) {
if (!empty($this->options['vids'][$vocab])) {
$tids[] = $tid;
diff --git a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
index 6d1b18c7647..e48931b5267 100644
--- a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
+++ b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
@@ -289,7 +289,7 @@ class TaxonomyIndexTid extends ManyToOne {
}
if (!$form_state->get('exposed')) {
- // Retain the helper option
+ // Retain the helper option.
$this->helper->buildOptionsForm($form, $form_state);
// Show help text if not exposed to end users.
@@ -330,7 +330,7 @@ class TaxonomyIndexTid extends ManyToOne {
}
// If view is an attachment and is inheriting exposed filters, then assume
- // exposed input has already been validated
+ // exposed input has already been validated.
if (!empty($this->view->is_attachment) && $this->view->display_handler->usesExposed()) {
$this->validated_exposed_input = (array) $this->view->exposed_raw_input[$this->options['expose']['identifier']];
}
@@ -418,7 +418,7 @@ class TaxonomyIndexTid extends ManyToOne {
* {@inheritdoc}
*/
public function adminSummary() {
- // Set up $this->valueOptions for the parent summary
+ // Set up $this->valueOptions for the parent summary.
$this->valueOptions = [];
if ($this->value) {
diff --git a/core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php b/core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php
index 5987d9fe933..28c9cc8b06b 100644
--- a/core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php
+++ b/core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php
@@ -109,7 +109,7 @@ class NodeTermData extends RelationshipPluginBase {
$def['type'] = empty($this->options['required']) ? 'LEFT' : 'INNER';
}
else {
- // If vocabularies are supplied join a subselect instead
+ // If vocabularies are supplied join a subselect instead.
$def['left_table'] = $this->tableAlias;
$def['left_field'] = 'nid';
$def['field'] = 'nid';
diff --git a/core/modules/taxonomy/src/TermViewsData.php b/core/modules/taxonomy/src/TermViewsData.php
index 7ca182d9693..c6a1463fc25 100644
--- a/core/modules/taxonomy/src/TermViewsData.php
+++ b/core/modules/taxonomy/src/TermViewsData.php
@@ -139,12 +139,12 @@ class TermViewsData extends EntityViewsData {
$data['taxonomy_index']['table']['join'] = [
'taxonomy_term_field_data' => [
- // Links directly to taxonomy_term_field_data via tid
+ // Links directly to taxonomy_term_field_data via tid.
'left_field' => 'tid',
'field' => 'tid',
],
'node_field_data' => [
- // Links directly to node via nid
+ // Links directly to node via nid.
'left_field' => 'nid',
'field' => 'nid',
],
diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module
index 28e54b11f71..6694f62e563 100644
--- a/core/modules/taxonomy/taxonomy.module
+++ b/core/modules/taxonomy/taxonomy.module
@@ -10,21 +10,6 @@ use Drupal\Core\Render\Element;
use Drupal\taxonomy\Entity\Term;
/**
- * Implements hook_theme_suggestions_HOOK().
- */
-function taxonomy_theme_suggestions_taxonomy_term(array $variables): array {
- $suggestions = [];
-
- /** @var \Drupal\taxonomy\TermInterface $term */
- $term = $variables['elements']['#taxonomy_term'];
-
- $suggestions[] = 'taxonomy_term__' . $term->bundle();
- $suggestions[] = 'taxonomy_term__' . $term->id();
-
- return $suggestions;
-}
-
-/**
* Prepares variables for taxonomy term templates.
*
* Default template: taxonomy-term.html.twig.
diff --git a/core/modules/taxonomy/tests/src/Functional/TermLanguageTest.php b/core/modules/taxonomy/tests/src/Functional/TermLanguageTest.php
index 4fa2b896c25..11ba24f7c06 100644
--- a/core/modules/taxonomy/tests/src/Functional/TermLanguageTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/TermLanguageTest.php
@@ -164,7 +164,7 @@ class TermLanguageTest extends TaxonomyTestBase {
]);
$term->save();
- // Overview page in the other language shows the translated term
+ // Overview page in the other language shows the translated term.
$this->drupalGet('bb/admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview');
$this->assertSession()->responseMatches('|<a[^>]*>' . $translated_title . '</a>|');
}