class Term

Same name in this branch

Defines the taxonomy term entity.

Plugin annotation


@EntityType(
  id = "taxonomy_term",
  label = @Translation("Taxonomy term"),
  bundle_label = @Translation("Vocabulary"),
  module = "taxonomy",
  controllers = {
    "storage" = "Drupal\taxonomy\TermStorageController",
    "render" = "Drupal\taxonomy\TermRenderController",
    "access" = "Drupal\taxonomy\TermAccessController",
    "form" = {
      "default" = "Drupal\taxonomy\TermFormController"
    },
    "translation" = "Drupal\taxonomy\TermTranslationController"
  },
  base_table = "taxonomy_term_data",
  uri_callback = "taxonomy_term_uri",
  fieldable = TRUE,
  translatable = TRUE,
  entity_keys = {
    "id" = "tid",
    "bundle" = "vid",
    "label" = "name",
    "uuid" = "uuid"
  },
  bundle_keys = {
    "bundle" = "vid"
  },
  links = {
    "canonical" = "/taxonomy/term/{taxonomy_term}",
    "edit-form" = "/taxonomy/term/{taxonomy_term}/edit"
  },
  menu_base_path = "taxonomy/term/%taxonomy_term",
  route_base_path = "admin/structure/taxonomy/manage/{bundle}",
  permission_granularity = "bundle"
)

Hierarchy

Expanded class hierarchy of Term

7 files declare their use of Term
DeleteForm.php in drupal/core/modules/forum/lib/Drupal/forum/Form/DeleteForm.php
Contains \Drupal\forum\Form\DeleteForm.
forum.admin.inc in drupal/core/modules/forum/forum.admin.inc
Administrative page callbacks for the Forum module.
forum.module in drupal/core/modules/forum/forum.module
Provides discussion forums.
path.module in drupal/core/modules/path/path.module
Enables users to rename URLs.
taxonomy.admin.inc in drupal/core/modules/taxonomy/taxonomy.admin.inc
Administrative page callbacks for the taxonomy module.

... See full list

3 string references to 'Term'
forum_views_data in drupal/core/modules/forum/forum.views.inc
Implements hook_views_data().
TaxonomyTermReferenceItem::getPropertyDefinitions in drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Type/TaxonomyTermReferenceItem.php
Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinitions().
taxonomy_views_data in drupal/core/modules/taxonomy/taxonomy.views.inc
Implements hook_views_data().

File

drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Term.php, line 55
Definition of Drupal\taxonomy\Plugin\Core\Entity\Term.

Namespace

Drupal\taxonomy\Plugin\Core\Entity
View source
class Term extends EntityNG implements TermInterface {

  /**
   * The taxonomy term ID.
   *
   * @var \Drupal\Core\Entity\Field\FieldInterface
   */
  public $tid;

  /**
   * The term UUID.
   *
   * @var \Drupal\Core\Entity\Field\FieldInterface
   */
  public $uuid;

  /**
   * The taxonomy vocabulary ID this term belongs to.
   *
   * @var \Drupal\Core\Entity\Field\FieldInterface
   */
  public $vid;

  /**
   * Name of the term.
   *
   * @var \Drupal\Core\Entity\Field\FieldInterface
   */
  public $name;

  /**
   * Description of the term.
   *
   * @var \Drupal\Core\Entity\Field\FieldInterface
   */
  public $description;

  /**
   * The text format name for the term's description.
   *
   * @var \Drupal\Core\Entity\Field\FieldInterface
   */
  public $format;

  /**
   * The weight of this term.
   *
   * This property stores the weight of this term in relation to other terms of
   * the same vocabulary.
   *
   * @var \Drupal\Core\Entity\Field\FieldInterface
   */
  public $weight;

  /**
   * The parent term(s) for this term.
   *
   * This property is not loaded, but may be used to modify the term parents via
   * Term::save().
   *
   * The property can be set to an array of term IDs. An entry of 0 means this
   * term does not have any parents. When omitting this variable during an
   * update, the existing hierarchy for the term remains unchanged.
   *
   * @var \Drupal\Core\Entity\Field\FieldInterface
   */
  public $parent;

  /**
   * Default values for the term.
   *
   * @var array
   */
  protected $values = array(
    'langcode' => array(
      Language::LANGCODE_DEFAULT => array(
        0 => array(
          'value' => Language::LANGCODE_NOT_SPECIFIED,
        ),
      ),
    ),
    'weight' => array(
      Language::LANGCODE_DEFAULT => array(
        0 => array(
          'value' => 0,
        ),
      ),
    ),
  );

  /**
   * Implements Drupal\Core\Entity\EntityInterface::id().
   */
  public function id() {
    return $this
      ->get('tid')->value;
  }

  /**
   * Overides \Drupal\Core\Entity\EntityNG::init().
   */
  protected function init() {
    parent::init();
    unset($this->tid);
    unset($this->uuid);
    unset($this->vid);
    unset($this->name);
    unset($this->weight);
    unset($this->format);
    unset($this->description);
    unset($this->parent);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Entity::$enforceIsNew protected property Boolean indicating whether the entity should be forced to be new.
Entity::$entityType protected property The entity type.
Entity::$isDefaultRevision protected property Indicates whether this is the default revision. 1
Entity::$langcode public property The language code of the entity's default language. 7
Entity::$newRevision protected property Boolean indicating whether a new revision should be created on save.
Entity::access public function Implements \Drupal\Core\TypedData\AccessibleInterface::access(). Overrides AccessibleInterface::access
Entity::delete public function Implements \Drupal\Core\Entity\EntityInterface::delete(). Overrides EntityInterface::delete 3
Entity::enforceIsNew public function Implements \Drupal\Core\Entity\EntityInterface::enforceIsNew(). Overrides EntityInterface::enforceIsNew
Entity::entityInfo public function Implements \Drupal\Core\Entity\EntityInterface::entityInfo(). Overrides EntityInterface::entityInfo
Entity::entityType public function Implements \Drupal\Core\Entity\EntityInterface::entityType(). Overrides EntityInterface::entityType
Entity::getConstraints public function Implements \Drupal\Core\TypedData\TypedDataInterface::getConstraints(). Overrides TypedDataInterface::getConstraints
Entity::getDefinition public function Implements \Drupal\Core\TypedData\TypedDataInterface::getDefinition(). Overrides TypedDataInterface::getDefinition
Entity::getExportProperties public function Implements \Drupal\Core\Entity\EntityInterface::getExportProperties(). Overrides EntityInterface::getExportProperties 1
Entity::getName public function Implements \Drupal\Core\TypedData\TypedDataInterface::getName(). Overrides TypedDataInterface::getName
Entity::getNGEntity public function Implements \Drupal\Core\Entity\EntityInterface::getNGEntity(). Overrides EntityInterface::getNGEntity
Entity::getParent public function Implements \Drupal\Core\TypedData\TypedDataInterface::getParent(). Overrides TypedDataInterface::getParent
Entity::getPropertyPath public function Implements \Drupal\Core\TypedData\TypedDataInterface::getPropertyPath(). Overrides TypedDataInterface::getPropertyPath
Entity::getRevisionId public function Implements \Drupal\Core\Entity\EntityInterface::getRevisionId(). Overrides EntityInterface::getRevisionId 4
Entity::getRoot public function Implements \Drupal\Core\TypedData\TypedDataInterface::getRoot(). Overrides TypedDataInterface::getRoot
Entity::getString public function Implements \Drupal\Core\TypedData\TypedDataInterface::getString(). Overrides TypedDataInterface::getString
Entity::getValue public function Implements \Drupal\Core\TypedData\TypedDataInterface::getValue(). Overrides TypedDataInterface::getValue
Entity::isDefaultRevision public function Implements \Drupal\Core\Entity\EntityInterface::isDefaultRevision(). Overrides EntityInterface::isDefaultRevision 1
Entity::isNew public function Implements \Drupal\Core\Entity\EntityInterface::isNew(). Overrides EntityInterface::isNew 1
Entity::isNewRevision public function Implements \Drupal\Core\Entity\EntityInterface::isNewRevision(). Overrides EntityInterface::isNewRevision
Entity::isTranslatable public function Implements \Drupal\Core\Entity\EntityInterface::isTranslatable(). Overrides EntityInterface::isTranslatable
Entity::onChange public function Implements \Drupal\Core\TypedData\ComplexDataInterface::onChange(). Overrides ComplexDataInterface::onChange
Entity::save public function Implements \Drupal\Core\Entity\EntityInterface::save(). Overrides EntityInterface::save 6
Entity::setContext public function Implements \Drupal\Core\TypedData\TypedDataInterface::setContext(). Overrides TypedDataInterface::setContext
Entity::setNewRevision public function Implements \Drupal\Core\Entity\EntityInterface::setNewRevision(). Overrides EntityInterface::setNewRevision
Entity::setValue public function Implements \Drupal\Core\TypedData\TypedDataInterface::setValue(). Overrides TypedDataInterface::setValue
Entity::uriRelationships public function Returns a list of URI relationships supported by this entity. Overrides EntityInterface::uriRelationships
EntityNG::$bcEntity protected property An instance of the backward compatibility decorator.
EntityNG::$bundle protected property Local cache holding the value of the bundle field.
EntityNG::$fieldDefinitions protected property Local cache for field definitions.
EntityNG::$fields protected property The array of fields, each being an instance of FieldInterface.
EntityNG::$uriPlaceholderReplacements protected property Local cache for URI placeholder substitution values.
EntityNG::bundle public function Implements \Drupal\Core\Entity\EntityInterface::bundle(). Overrides Entity::bundle
EntityNG::createDuplicate public function Overrides Entity::createDuplicate(). Overrides Entity::createDuplicate 1
EntityNG::get public function Implements \Drupal\Core\TypedData\ComplexDataInterface::get(). Overrides Entity::get
EntityNG::getBCEntity public function Overrides Entity::getBCEntity(). Overrides Entity::getBCEntity 2
EntityNG::getIterator public function Implements \IteratorAggregate::getIterator(). Overrides Entity::getIterator
EntityNG::getProperties public function Implements \Drupal\Core\TypedData\ComplexDataInterface::getProperties(). Overrides Entity::getProperties
EntityNG::getPropertyDefinition public function Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinition(). Overrides Entity::getPropertyDefinition
EntityNG::getPropertyDefinitions public function Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinitions(). Overrides Entity::getPropertyDefinitions
EntityNG::getPropertyValues public function Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyValues(). Overrides Entity::getPropertyValues
EntityNG::getTranslatedField protected function Gets a translated field.
EntityNG::getTranslation public function Implements \Drupal\Core\TypedData\TranslatableInterface::getTranslation(). Overrides Entity::getTranslation
EntityNG::getTranslationLanguages public function Implements \Drupal\Core\TypedData\TranslatableInterface::getTranslationLanguages(). Overrides Entity::getTranslationLanguages
EntityNG::getType public function Gets the typed data type of the entity. Overrides Entity::getType
EntityNG::isEmpty public function Implements \Drupal\Core\TypedData\ComplexDataInterface::isEmpty(). Overrides Entity::isEmpty
EntityNG::label public function Overrides Entity::label() to access the label field with the new API. Overrides Entity::label 3
EntityNG::language public function Implements \Drupal\Core\TypedData\TranslatableInterface::language(). Overrides Entity::language
EntityNG::set public function Implements \Drupal\Core\TypedData\ComplexDataInterface::set(). Overrides Entity::set
EntityNG::setPropertyValues public function Implements \Drupal\Core\TypedData\ComplexDataInterface::setPropertyValues(). Overrides Entity::setPropertyValues
EntityNG::translations public function Overrides Entity::translations(). Overrides Entity::translations
EntityNG::updateOriginalValues public function Updates the original values with the interim changes.
EntityNG::uri public function Implements \Drupal\Core\Entity\EntityInterface::uri(). Overrides Entity::uri 1
EntityNG::uriPlaceholderReplacements protected function Returns an array of placeholders for this entity.
EntityNG::uuid public function Overrides Entity::uuid(). Overrides Entity::uuid
EntityNG::validate public function Implements \Drupal\Core\TypedData\TypedDataInterface::validate(). Overrides Entity::validate
EntityNG::__clone public function Magic method: Implements a deep clone.
EntityNG::__construct public function Overrides Entity::__construct(). Overrides Entity::__construct
EntityNG::__get public function Implements the magic method for setting object properties.
EntityNG::__isset public function Implements the magic method for isset().
EntityNG::__set public function Implements the magic method for setting object properties.
EntityNG::__unset public function Implements the magic method for unset.
EntityNG::__wakeup public function Magic __wakeup() implementation.
Term::$description public property Description of the term.
Term::$format public property The text format name for the term's description.
Term::$name public property Name of the term.
Term::$parent public property The parent term(s) for this term.
Term::$tid public property The taxonomy term ID.
Term::$uuid public property The term UUID.
Term::$values protected property Default values for the term. Overrides EntityNG::$values
Term::$vid public property The taxonomy vocabulary ID this term belongs to.
Term::$weight public property The weight of this term.
Term::id public function Implements Drupal\Core\Entity\EntityInterface::id(). Overrides EntityNG::id
Term::init protected function Overides \Drupal\Core\Entity\EntityNG::init(). Overrides EntityNG::init