interface TermStorageInterface

Same name and namespace in other branches
  1. 9 core/modules/taxonomy/src/TermStorageInterface.php \Drupal\taxonomy\TermStorageInterface
  2. 10 core/modules/taxonomy/src/TermStorageInterface.php \Drupal\taxonomy\TermStorageInterface
  3. 11.x core/modules/taxonomy/src/TermStorageInterface.php \Drupal\taxonomy\TermStorageInterface

Defines an interface for taxonomy_term entity storage classes.

Hierarchy

Expanded class hierarchy of TermStorageInterface

All classes that implement TermStorageInterface

6 files declare their use of TermStorageInterface
ForumController.php in core/modules/forum/src/Controller/ForumController.php
ForumListingBreadcrumbBuilderTest.php in core/modules/forum/tests/src/Unit/Breadcrumb/ForumListingBreadcrumbBuilderTest.php
ForumNodeBreadcrumbBuilderTest.php in core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php
TaxonomyIndexTid.php in core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
TaxonomyTermHierarchyConstraintValidator.php in core/modules/taxonomy/src/Plugin/Validation/Constraint/TaxonomyTermHierarchyConstraintValidator.php

... See full list

File

core/modules/taxonomy/src/TermStorageInterface.php, line 11

Namespace

Drupal\taxonomy
View source
interface TermStorageInterface extends ContentEntityStorageInterface {
    
    /**
     * Removed reference to terms from term_hierarchy.
     *
     * @param array $tids
     *   Array of terms that need to be removed from hierarchy.
     *
     * @todo Remove this method in Drupal 9.0.x. Now the parent references are
     *   automatically cleared when deleting a taxonomy term.
     *   https://www.drupal.org/node/2785693
     */
    public function deleteTermHierarchy($tids);
    
    /**
     * Updates terms hierarchy information with the hierarchy trail of it.
     *
     * @param \Drupal\Core\Entity\EntityInterface $term
     *   Term entity that needs to be added to term hierarchy information.
     *
     * @todo remove this method Drupal 9.0.x. Now the parent references are
     *   automatically updates when when a taxonomy term is added/updated.
     *   https://www.drupal.org/node/2785693
     */
    public function updateTermHierarchy(EntityInterface $term);
    
    /**
     * Finds all parents of a given term ID.
     *
     * @param int $tid
     *   Term ID to retrieve parents for.
     *
     * @return \Drupal\taxonomy\TermInterface[]
     *   An array of term objects which are the parents of the term $tid.
     */
    public function loadParents($tid);
    
    /**
     * Finds all ancestors of a given term ID.
     *
     * @param int $tid
     *   Term ID to retrieve ancestors for.
     *
     * @return \Drupal\taxonomy\TermInterface[]
     *   An array of term objects which are the ancestors of the term $tid.
     */
    public function loadAllParents($tid);
    
    /**
     * Finds all children of a term ID.
     *
     * @param int $tid
     *   Term ID to retrieve children for.
     * @param string $vid
     *   An optional vocabulary ID to restrict the child search.
     *
     * @return \Drupal\taxonomy\TermInterface[]
     *   An array of term objects that are the children of the term $tid.
     */
    public function loadChildren($tid, $vid = NULL);
    
    /**
     * Finds all terms in a given vocabulary ID.
     *
     * @param string $vid
     *   Vocabulary ID to retrieve terms for.
     * @param int $parent
     *   The term ID under which to generate the tree. If 0, generate the tree
     *   for the entire vocabulary.
     * @param int $max_depth
     *   The number of levels of the tree to return. Leave NULL to return all
     *   levels.
     * @param bool $load_entities
     *   If TRUE, a full entity load will occur on the term objects. Otherwise
     *   they are partial objects queried directly from the {taxonomy_term_data}
     *   table to save execution time and memory consumption when listing large
     *   numbers of terms. Defaults to FALSE.
     *
     * @return object[]|\Drupal\taxonomy\TermInterface[]
     *   An array of term objects that are the children of the vocabulary $vid.
     */
    public function loadTree($vid, $parent = 0, $max_depth = NULL, $load_entities = FALSE);
    
    /**
     * Count the number of nodes in a given vocabulary ID.
     *
     * @param string $vid
     *   Vocabulary ID to retrieve terms for.
     *
     * @return int
     *   A count of the nodes in a given vocabulary ID.
     */
    public function nodeCount($vid);
    
    /**
     * Reset the weights for a given vocabulary ID.
     *
     * @param string $vid
     *   Vocabulary ID to retrieve terms for.
     */
    public function resetWeights($vid);
    
    /**
     * Returns all terms used to tag some given nodes.
     *
     * @param array $nids
     *   Node IDs to retrieve terms for.
     * @param array $vocabs
     *   (optional) A vocabularies array to restrict the term search. Defaults to
     *   empty array.
     * @param string $langcode
     *   (optional) A language code to restrict the term search. Defaults to NULL.
     *
     * @return array
     *   An array of nids and the term entities they were tagged with.
     */
    public function getNodeTerms(array $nids, array $vocabs = [], $langcode = NULL);
    
    /**
     * Returns the hierarchy type for a specific vocabulary ID.
     *
     * @param string $vid
     *   Vocabulary ID to retrieve the hierarchy type for.
     *
     * @return int
     *   The vocabulary hierarchy.
     *   Possible values:
     *    - VocabularyInterface::HIERARCHY_DISABLED: No parents.
     *    - VocabularyInterface::HIERARCHY_SINGLE: Single parent.
     *    - VocabularyInterface::HIERARCHY_MULTIPLE: Multiple parents.
     */
    public function getVocabularyHierarchyType($vid);
    
    /**
     * Gets a list of term IDs with pending revisions.
     *
     * @return int[]
     *   An array of term IDs which have pending revisions, keyed by their
     *   revision IDs.
     *
     * @internal
     */
    public function getTermIdsWithPendingRevisions();

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
ContentEntityStorageInterface::createWithSampleValues public function Creates an entity with sample field values. 2
EntityStorageInterface::create public function Constructs a new entity object, without permanently saving it. 1
EntityStorageInterface::delete public function Deletes permanently saved entities. 1
EntityStorageInterface::deleteRevision public function Delete a specific entity revision. 4
EntityStorageInterface::FIELD_LOAD_CURRENT constant Load the most recent version of an entity's field data.
EntityStorageInterface::FIELD_LOAD_REVISION constant Load the version of an entity's field data specified in the entity.
EntityStorageInterface::getAggregateQuery public function Gets an aggregated query instance. 1
EntityStorageInterface::getEntityType public function Gets the entity type definition. 1
EntityStorageInterface::getEntityTypeId public function Gets the entity type ID. 1
EntityStorageInterface::getQuery public function Gets an entity query instance. 1
EntityStorageInterface::hasData public function Determines if the storage contains any data. 1
EntityStorageInterface::load public function Loads one entity. 1
EntityStorageInterface::loadByProperties public function Load entities by their property values. 1
EntityStorageInterface::loadMultiple public function Loads one or more entities. 1
EntityStorageInterface::loadRevision public function Load a specific entity revision. 4
EntityStorageInterface::loadUnchanged public function Loads an unchanged entity from the database. 1
EntityStorageInterface::resetCache public function Resets the internal, static entity cache. 1
EntityStorageInterface::restore public function Restores a previously saved entity. 1
EntityStorageInterface::save public function Saves the entity permanently. 1
RevisionableStorageInterface::getLatestRevisionId public function Returns the latest revision identifier for an entity. 2
RevisionableStorageInterface::loadMultipleRevisions public function Loads multiple entity revisions. 2
TermStorageInterface::deleteTermHierarchy public function Removed reference to terms from term_hierarchy. 1
TermStorageInterface::getNodeTerms public function Returns all terms used to tag some given nodes. 1
TermStorageInterface::getTermIdsWithPendingRevisions public function Gets a list of term IDs with pending revisions. 1
TermStorageInterface::getVocabularyHierarchyType public function Returns the hierarchy type for a specific vocabulary ID. 1
TermStorageInterface::loadAllParents public function Finds all ancestors of a given term ID. 1
TermStorageInterface::loadChildren public function Finds all children of a term ID. 1
TermStorageInterface::loadParents public function Finds all parents of a given term ID. 1
TermStorageInterface::loadTree public function Finds all terms in a given vocabulary ID. 1
TermStorageInterface::nodeCount public function Count the number of nodes in a given vocabulary ID. 1
TermStorageInterface::resetWeights public function Reset the weights for a given vocabulary ID. 1
TermStorageInterface::updateTermHierarchy public function Updates terms hierarchy information with the hierarchy trail of it. 1
TranslatableRevisionableStorageInterface::createRevision public function Creates a new revision starting off from the specified entity object. Overrides RevisionableStorageInterface::createRevision 2
TranslatableRevisionableStorageInterface::getLatestTranslationAffectedRevisionId public function Returns the latest revision affecting the specified translation. 2
TranslatableStorageInterface::createTranslation public function Constructs a new entity translation object, without permanently saving it. 2

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.