Backup of db before drupal security update
[yaffs-website] / web / core / modules / taxonomy / src / TermStorageInterface.php
1 <?php
2
3 namespace Drupal\taxonomy;
4
5 use Drupal\Core\Entity\EntityInterface;
6 use Drupal\Core\Entity\ContentEntityStorageInterface;
7
8 /**
9  * Defines an interface for taxonomy_term entity storage classes.
10  */
11 interface TermStorageInterface extends ContentEntityStorageInterface {
12
13   /**
14    * Removed reference to terms from term_hierarchy.
15    *
16    * @param array $tids
17    *   Array of terms that need to be removed from hierarchy.
18    */
19   public function deleteTermHierarchy($tids);
20
21   /**
22    * Updates terms hierarchy information with the hierarchy trail of it.
23    *
24    * @param \Drupal\Core\Entity\EntityInterface $term
25    *   Term entity that needs to be added to term hierarchy information.
26    */
27   public function updateTermHierarchy(EntityInterface $term);
28
29   /**
30    * Finds all parents of a given term ID.
31    *
32    * @param int $tid
33    *   Term ID to retrieve parents for.
34    *
35    * @return \Drupal\taxonomy\TermInterface[]
36    *   An array of term objects which are the parents of the term $tid.
37    */
38   public function loadParents($tid);
39
40   /**
41    * Finds all ancestors of a given term ID.
42    *
43    * @param int $tid
44    *   Term ID to retrieve ancestors for.
45    *
46    * @return \Drupal\taxonomy\TermInterface[]
47    *   An array of term objects which are the ancestors of the term $tid.
48    */
49   public function loadAllParents($tid);
50
51   /**
52    * Finds all children of a term ID.
53    *
54    * @param int $tid
55    *   Term ID to retrieve parents for.
56    * @param string $vid
57    *   An optional vocabulary ID to restrict the child search.
58    *
59    * @return \Drupal\taxonomy\TermInterface[]
60    *   An array of term objects that are the children of the term $tid.
61    */
62   public function loadChildren($tid, $vid = NULL);
63
64   /**
65    * Finds all terms in a given vocabulary ID.
66    *
67    * @param string $vid
68    *   Vocabulary ID to retrieve terms for.
69    * @param int $parent
70    *   The term ID under which to generate the tree. If 0, generate the tree
71    *   for the entire vocabulary.
72    * @param int $max_depth
73    *   The number of levels of the tree to return. Leave NULL to return all
74    *   levels.
75    * @param bool $load_entities
76    *   If TRUE, a full entity load will occur on the term objects. Otherwise
77    *   they are partial objects queried directly from the {taxonomy_term_data}
78    *   table to save execution time and memory consumption when listing large
79    *   numbers of terms. Defaults to FALSE.
80    *
81    * @return object[]|\Drupal\taxonomy\TermInterface[]
82    *   An array of term objects that are the children of the vocabulary $vid.
83    */
84   public function loadTree($vid, $parent = 0, $max_depth = NULL, $load_entities = FALSE);
85
86   /**
87    * Count the number of nodes in a given vocabulary ID.
88    *
89    * @param string $vid
90    *   Vocabulary ID to retrieve terms for.
91    *
92    * @return int
93    *   A count of the nodes in a given vocabulary ID.
94    */
95   public function nodeCount($vid);
96
97   /**
98    * Reset the weights for a given vocabulary ID.
99    *
100    * @param string $vid
101    *   Vocabulary ID to retrieve terms for.
102    */
103   public function resetWeights($vid);
104
105   /**
106    * Returns all terms used to tag some given nodes.
107    *
108    * @param array $nids
109    *   Node IDs to retrieve terms for.
110    * @param array $vocabs
111    *   (optional) A vocabularies array to restrict the term search. Defaults to
112    *   empty array.
113    * @param string $langcode
114    *   (optional) A language code to restrict the term search. Defaults to NULL.
115    *
116    * @return array
117    *   An array of nids and the term entities they were tagged with.
118    */
119   public function getNodeTerms(array $nids, array $vocabs = [], $langcode = NULL);
120
121 }