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