NodeInterface.php 3.79 KB
Newer Older
1 2 3 4
<?php

namespace Drupal\node;

5
use Drupal\Core\Entity\EntityPublishedInterface;
6
use Drupal\Core\Entity\RevisionLogInterface;
7
use Drupal\user\EntityOwnerInterface;
8
use Drupal\Core\Entity\EntityChangedInterface;
9 10 11 12 13
use Drupal\Core\Entity\ContentEntityInterface;

/**
 * Provides an interface defining a node entity.
 */
14
interface NodeInterface extends ContentEntityInterface, EntityChangedInterface, EntityOwnerInterface, RevisionLogInterface, EntityPublishedInterface {
15

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
  /**
   * Denotes that the node is not published.
   */
  const NOT_PUBLISHED = 0;

  /**
   * Denotes that the node is published.
   */
  const PUBLISHED = 1;

  /**
   * Denotes that the node is not promoted to the front page.
   */
  const NOT_PROMOTED = 0;

  /**
   * Denotes that the node is promoted to the front page.
   */
  const PROMOTED = 1;

  /**
   * Denotes that the node is not sticky at the top of the page.
   */
  const NOT_STICKY = 0;

  /**
   * Denotes that the node is sticky at the top of the page.
   */
  const STICKY = 1;

46
  /**
47
   * Gets the node type.
48 49 50 51 52 53 54
   *
   * @return string
   *   The node type.
   */
  public function getType();

  /**
55
   * Gets the node title.
56 57 58 59 60 61
   *
   * @return string
   *   Title of the node.
   */
  public function getTitle();

62 63 64 65 66 67 68 69 70 71 72 73
  /**
   * Sets the node title.
   *
   * @param string $title
   *   The node title.
   *
   * @return \Drupal\node\NodeInterface
   *   The called node entity.
   */
  public function setTitle($title);

  /**
74
   * Gets the node creation timestamp.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
   *
   * @return int
   *   Creation timestamp of the node.
   */
  public function getCreatedTime();

  /**
   * Sets the node creation timestamp.
   *
   * @param int $timestamp
   *   The node creation timestamp.
   *
   * @return \Drupal\node\NodeInterface
   *   The called node entity.
   */
  public function setCreatedTime($timestamp);

  /**
   * Returns the node promotion status.
   *
   * @return bool
   *   TRUE if the node is promoted.
   */
  public function isPromoted();

  /**
   * Sets the node promoted status.
   *
   * @param bool $promoted
   *   TRUE to set this node to promoted, FALSE to set it to not promoted.
   *
   * @return \Drupal\node\NodeInterface
   *   The called node entity.
   */
  public function setPromoted($promoted);

  /**
   * Returns the node sticky status.
   *
   * @return bool
   *   TRUE if the node is sticky.
   */
  public function isSticky();

  /**
   * Sets the node sticky status.
   *
   * @param bool $sticky
   *   TRUE to set this node to sticky, FALSE to set it to not sticky.
   *
   * @return \Drupal\node\NodeInterface
   *   The called node entity.
   */
  public function setSticky($sticky);

  /**
131
   * Gets the node revision creation timestamp.
132 133 134 135 136 137 138 139 140
   *
   * @return int
   *   The UNIX timestamp of when this revision was created.
   */
  public function getRevisionCreationTime();

  /**
   * Sets the node revision creation timestamp.
   *
141
   * @param int $timestamp
142 143 144 145 146 147 148 149
   *   The UNIX timestamp of when this revision was created.
   *
   * @return \Drupal\node\NodeInterface
   *   The called node entity.
   */
  public function setRevisionCreationTime($timestamp);

  /**
150
   * Gets the node revision author.
151 152 153
   *
   * @return \Drupal\user\UserInterface
   *   The user entity for the revision author.
154 155 156
   *
   * @deprecated in Drupal 8.2.0, will be removed before Drupal 9.0.0. Use
   *   \Drupal\Core\Entity\RevisionLogInterface::getRevisionUser() instead.
157 158 159 160 161 162 163 164 165 166 167
   */
  public function getRevisionAuthor();

  /**
   * Sets the node revision author.
   *
   * @param int $uid
   *   The user ID of the revision author.
   *
   * @return \Drupal\node\NodeInterface
   *   The called node entity.
168 169 170
   *
   * @deprecated in Drupal 8.2.0, will be removed before Drupal 9.0.0. Use
   *   \Drupal\Core\Entity\RevisionLogInterface::setRevisionUserId() instead.
171 172 173
   */
  public function setRevisionAuthorId($uid);

174
}