Vocabulary.php

Contains \Drupal\taxonomy\Plugin\Core\Entity\Vocabulary.

Namespace

Drupal\taxonomy\Plugin\Core\Entity

File

drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Vocabulary.php
View source
<?php

/**
 * @file
 * Contains \Drupal\taxonomy\Plugin\Core\Entity\Vocabulary.
 */
namespace Drupal\taxonomy\Plugin\Core\Entity;

use Drupal\Core\Config\Entity\ConfigEntityBase;
use Drupal\Core\Entity\Annotation\EntityType;
use Drupal\Core\Annotation\Translation;
use Drupal\taxonomy\VocabularyInterface;

/**
 * Defines the taxonomy vocabulary entity.
 *
 * @EntityType(
 *   id = "taxonomy_vocabulary",
 *   label = @Translation("Taxonomy vocabulary"),
 *   module = "taxonomy",
 *   controllers = {
 *     "storage" = "Drupal\taxonomy\VocabularyStorageController",
 *     "access" = "Drupal\taxonomy\VocabularyAccessController",
 *     "list" = "Drupal\taxonomy\VocabularyListController",
 *     "form" = {
 *       "default" = "Drupal\taxonomy\VocabularyFormController"
 *     }
 *   },
 *   config_prefix = "taxonomy.vocabulary",
 *   entity_keys = {
 *     "id" = "vid",
 *     "label" = "name",
 *     "uuid" = "uuid"
 *   }
 * )
 */
class Vocabulary extends ConfigEntityBase implements VocabularyInterface {

  /**
   * The taxonomy vocabulary ID.
   *
   * @var string
   */
  public $vid;

  /**
   * The vocabulary UUID.
   *
   * @var string
   */
  public $uuid;

  /**
   * Name of the vocabulary.
   *
   * @var string
   */
  public $name;

  /**
   * Description of the vocabulary.
   *
   * @var string
   */
  public $description;

  /**
   * The type of hierarchy allowed within the vocabulary.
   *
   * Possible values:
   * - TAXONOMY_HIERARCHY_DISABLED: No parents.
   * - TAXONOMY_HIERARCHY_SINGLE: Single parent.
   * - TAXONOMY_HIERARCHY_MULTIPLE: Multiple parents.
   *
   * @var integer
   */
  public $hierarchy = TAXONOMY_HIERARCHY_DISABLED;

  /**
   * The weight of this vocabulary in relation to other vocabularies.
   *
   * @var integer
   */
  public $weight = 0;

  /**
   * {@inheritdoc}
   */
  public function id() {
    return $this->vid;
  }

  /**
   * {@inheritdoc}
   */
  public function uri() {
    return array(
      'path' => 'admin/structure/taxonomy/manage/' . $this
        ->id(),
      'options' => array(
        'entity_type' => $this->entityType,
        'entity' => $this,
      ),
    );
  }

}

Classes

Namesort descending Description
Vocabulary Defines the taxonomy vocabulary entity.