class Node

Defines the node entity class.

Plugin annotation


@Plugin(
  id = "node",
  label = @Translation("Content"),
  module = "node",
  controller_class = "Drupal\node\NodeStorageController",
  render_controller_class = "Drupal\node\NodeRenderController",
  form_controller_class = {
    "default" = "Drupal\node\NodeFormController"
  },
  translation_controller_class = "Drupal\node\NodeTranslationController",
  base_table = "node",
  revision_table = "node_revision",
  uri_callback = "node_uri",
  fieldable = TRUE,
  entity_keys = {
    "id" = "nid",
    "revision" = "vid",
    "bundle" = "type",
    "label" = "title",
    "uuid" = "uuid"
  },
  bundle_keys = {
    "bundle" = "type"
  },
  view_modes = {
    "full" = {
      "label" = "Full content",
      "custom_settings" = FALSE
    },
    "teaser" = {
      "label" = "Teaser",
      "custom_settings" = TRUE
    },
    "rss" = {
      "label" = "RSS",
      "custom_settings" = FALSE
    }
  }
)

Hierarchy

Expanded class hierarchy of Node

27 files declare their use of Node
book.admin.inc in drupal/core/modules/book/book.admin.inc
Admin page callbacks for the book module.
book.module in drupal/core/modules/book/book.module
Allows users to create and organize related content in an outline.
book.pages.inc in drupal/core/modules/book/book.pages.inc
User page callbacks for the book module.
BookTest.php in drupal/core/modules/book/lib/Drupal/book/Tests/BookTest.php
Definition of Drupal\book\Tests\BookTest.
comment.module in drupal/core/modules/comment/comment.module
Enables users to comment on published content.

... See full list

43 string references to 'Node'
comment_token_info in drupal/core/modules/comment/comment.tokens.inc
Implements hook_token_info().
field_views_field_default_views_data in drupal/core/modules/field/field.views.inc
Default views data implementation for a field.
file_field_views_data_views_data_alter in drupal/core/modules/file/file.views.inc
Implements hook_field_views_data_views_data_alter().
image_field_views_data_views_data_alter in drupal/core/modules/image/image.views.inc
Implements hook_field_views_data_views_data_alter().
MultiStepNodeFormBasicOptionsTest::getInfo in drupal/core/modules/node/lib/Drupal/node/Tests/MultiStepNodeFormBasicOptionsTest.php

... See full list

File

drupal/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php, line 58
Definition of Drupal\node\Plugin\Core\Entity\Node.

Namespace

Drupal\node\Plugin\Core\Entity
View source
class Node extends Entity implements ContentEntityInterface {

  /**
   * The node ID.
   *
   * @var integer
   */
  public $nid;

  /**
   * The node revision ID.
   *
   * @var integer
   */
  public $vid;

  /**
   * Indicates whether this is the default node revision.
   *
   * The default revision of a node is the one loaded when no specific revision
   * has been specified. Only default revisions are saved to the node table.
   *
   * @var boolean
   */
  public $isDefaultRevision = TRUE;

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

  /**
   * The node content type (bundle).
   *
   * @var string
   */
  public $type;

  /**
   * The node language code.
   *
   * @var string
   */
  public $langcode = LANGUAGE_NOT_SPECIFIED;

  /**
   * The node title.
   *
   * @var string
   */
  public $title;

  /**
   * The node owner's user ID.
   *
   * @var integer
   */
  public $uid;

  /**
   * The node published status indicator.
   *
   * Unpublished nodes are only visible to their authors and to administrators.
   * The value is either NODE_PUBLISHED or NODE_NOT_PUBLISHED.
   *
   * @var integer
   */
  public $status;

  /**
   * The node creation timestamp.
   *
   * @var integer
   */
  public $created;

  /**
   * The node modification timestamp.
   *
   * @var integer
   */
  public $changed;

  /**
   * The node comment status indicator.
   *
   * COMMENT_NODE_HIDDEN => no comments
   * COMMENT_NODE_CLOSED => comments are read-only
   * COMMENT_NODE_OPEN => open (read/write)
   *
   * @var integer
   */
  public $comment;

  /**
   * The node promotion status.
   *
   * Promoted nodes should be displayed on the front page of the site. The value
   * is either NODE_PROMOTED or NODE_NOT_PROMOTED.
   *
   * @var integer
   */
  public $promote;

  /**
   * The node sticky status.
   *
   * Sticky nodes should be displayed at the top of lists in which they appear.
   * The value is either NODE_STICKY or NODE_NOT_STICKY.
   *
   * @var integer
   */
  public $sticky;

  /**
   * The node translation set ID.
   *
   * Translations sets are based on the ID of the node containing the source
   * text for the translation set.
   *
   * @var integer
   */
  public $tnid;

  /**
   * The node translation status.
   *
   * If the translation page needs to be updated, the value is 1; otherwise 0.
   *
   * @var integer
   */
  public $translate;

  /**
   * The node revision creation timestamp.
   *
   * @var integer
   */
  public $revision_timestamp;

  /**
   * The node revision author's user ID.
   *
   * @var integer
   */
  public $revision_uid;

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

  /**
   * Implements Drupal\Core\Entity\EntityInterface::bundle().
   */
  public function bundle() {
    return $this->type;
  }

  /**
   * Overrides Drupal\Core\Entity\Entity::createDuplicate().
   */
  public function createDuplicate() {
    $duplicate = parent::createDuplicate();
    $duplicate->vid = NULL;
    return $duplicate;
  }

  /**
   * Overrides Drupal\Core\Entity\Entity::getRevisionId().
   */
  public function getRevisionId() {
    return $this->vid;
  }

}

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::$newRevision protected property Boolean indicating whether a new revision should be created on save.
Entity::access public function Implements AccessibleInterface::access(). Overrides AccessibleInterface::access
Entity::delete public function Implements EntityInterface::delete(). Overrides EntityInterface::delete
Entity::enforceIsNew public function Implements EntityInterface::enforceIsNew(). Overrides EntityInterface::enforceIsNew
Entity::entityInfo public function Implements EntityInterface::entityInfo(). Overrides EntityInterface::entityInfo
Entity::entityType public function Implements EntityInterface::entityType(). Overrides EntityInterface::entityType
Entity::get public function Implements EntityInterface::get(). Overrides ComplexDataInterface::get 2
Entity::getIterator public function Implements ComplexDataInterface::getIterator(). 1
Entity::getProperties public function Implements ComplexDataInterface::getProperties(). Overrides ComplexDataInterface::getProperties 1
Entity::getPropertyDefinition public function Implements ComplexDataInterface::getPropertyDefinition(). Overrides ComplexDataInterface::getPropertyDefinition 1
Entity::getPropertyDefinitions public function Implements ComplexDataInterface::getPropertyDefinitions(). Overrides ComplexDataInterface::getPropertyDefinitions 1
Entity::getPropertyValues public function Implements ComplexDataInterface::getPropertyValues(). Overrides ComplexDataInterface::getPropertyValues 1
Entity::getTranslation public function Implements TranslatableInterface::getTranslation(). Overrides TranslatableInterface::getTranslation 1
Entity::getTranslationLanguages public function Implements TranslatableInterface::getTranslationLanguages(). Overrides TranslatableInterface::getTranslationLanguages 1
Entity::isDefaultRevision public function Implements Drupal\Core\Entity\EntityInterface::isDefaultRevision(). Overrides EntityInterface::isDefaultRevision 1
Entity::isEmpty public function Implements ComplexDataInterface::isEmpty(). Overrides ComplexDataInterface::isEmpty 1
Entity::isNew public function Implements EntityInterface::isNew(). Overrides EntityInterface::isNew 1
Entity::isNewRevision public function Implements EntityInterface::isNewRevision(). Overrides EntityInterface::isNewRevision
Entity::label public function Implements EntityInterface::label(). Overrides EntityInterface::label 1
Entity::language public function Implements TranslatableInterface::language(). Overrides TranslatableInterface::language 1
Entity::save public function Implements EntityInterface::save(). Overrides EntityInterface::save 3
Entity::set public function Implements ComplexDataInterface::set(). Overrides ComplexDataInterface::set 2
Entity::setNewRevision public function Implements EntityInterface::setNewRevision(). Overrides EntityInterface::setNewRevision
Entity::setPropertyValues public function Implements ComplexDataInterface::setPropertyValues(). Overrides ComplexDataInterface::setPropertyValues 1
Entity::translations public function Returns the languages the entity is translated to.
Entity::uri public function Implements EntityInterface::uri(). Overrides EntityInterface::uri 1
Entity::uuid public function Implements EntityInterface::uuid(). Overrides EntityInterface::uuid 1
Entity::__construct public function Constructs an Entity object. 2
Node::$changed public property The node modification timestamp.
Node::$comment public property The node comment status indicator.
Node::$created public property The node creation timestamp.
Node::$isDefaultRevision public property Indicates whether this is the default node revision. Overrides Entity::$isDefaultRevision
Node::$langcode public property The node language code. Overrides Entity::$langcode
Node::$nid public property The node ID.
Node::$promote public property The node promotion status.
Node::$revision_timestamp public property The node revision creation timestamp.
Node::$revision_uid public property The node revision author's user ID.
Node::$status public property The node published status indicator.
Node::$sticky public property The node sticky status.
Node::$title public property The node title.
Node::$tnid public property The node translation set ID.
Node::$translate public property The node translation status.
Node::$type public property The node content type (bundle).
Node::$uid public property The node owner's user ID.
Node::$uuid public property The node UUID.
Node::$vid public property The node revision ID.
Node::bundle public function Implements Drupal\Core\Entity\EntityInterface::bundle(). Overrides Entity::bundle
Node::createDuplicate public function Overrides Drupal\Core\Entity\Entity::createDuplicate(). Overrides Entity::createDuplicate
Node::getRevisionId public function Overrides Drupal\Core\Entity\Entity::getRevisionId(). Overrides Entity::getRevisionId
Node::id public function Implements Drupal\Core\Entity\EntityInterface::id(). Overrides Entity::id