Verified Commit 9ac4e8f1 authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3097428 by longwave, andypost: Remove node.module BC layers

parent 2e2cdabc
Loading
Loading
Loading
Loading
+0 −204
Original line number Diff line number Diff line
@@ -32,66 +32,6 @@
use Drupal\node\NodeTypeInterface;
use Drupal\user\UserInterface;

/**
 * Denotes that the node is not published.
 *
 * @deprecated in drupal:8.?.? and is removed from drupal:9.0.0.
 *   Use \Drupal\node\NodeInterface::NOT_PUBLISHED instead.
 *
 * @see https://www.drupal.org/node/2316145
 */
const NODE_NOT_PUBLISHED = 0;

/**
 * Denotes that the node is published.
 *
 * @deprecated in drupal:8.?.? and is removed from drupal:9.0.0.
 *   Use \Drupal\node\NodeInterface::PUBLISHED instead.
 *
 * @see https://www.drupal.org/node/2316145
 */
const NODE_PUBLISHED = 1;

/**
 * Denotes that the node is not promoted to the front page.
 *
 * @deprecated in drupal:8.?.? and is removed from drupal:9.0.0.
 *   Use \Drupal\node\NodeInterface::NOT_PROMOTED instead.
 *
 * @see https://www.drupal.org/node/2316145
 */
const NODE_NOT_PROMOTED = 0;

/**
 * Denotes that the node is promoted to the front page.
 *
 * @deprecated in drupal:8.?.? and is removed from drupal:9.0.0.
 *   Use \Drupal\node\NodeInterface::PROMOTED instead.
 *
 * @see https://www.drupal.org/node/2316145
 */
const NODE_PROMOTED = 1;

/**
 * Denotes that the node is not sticky at the top of the page.
 *
 * @deprecated in drupal:8.?.? and is removed from drupal:9.0.0.
 *   Use \Drupal\node\NodeInterface::NOT_STICKY instead.
 *
 * @see https://www.drupal.org/node/2316145
 */
const NODE_NOT_STICKY = 0;

/**
 * Denotes that the node is sticky at the top of the page.
 *
 * @deprecated in drupal:8.?.? and is removed from drupal:9.0.0.
 *   Use \Drupal\node\NodeInterface::STICKY instead.
 *
 * @see https://www.drupal.org/node/2316145
 */
const NODE_STICKY = 1;

/**
 * Implements hook_help().
 */
@@ -264,23 +204,6 @@ function node_mark($nid, $timestamp) {
  return MARK_READ;
}

/**
 * Returns a list of all the available node types.
 *
 * This list can include types that are queued for addition or deletion.
 *
 * @return \Drupal\node\NodeTypeInterface[]
 *   An array of node type entities, keyed by ID.
 *
 * @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.
 *   Use \Drupal\node\Entity\NodeType::loadMultiple().
 *
 * @see \Drupal\node\Entity\NodeType::load()
 */
function node_type_get_types() {
  return NodeType::loadMultiple();
}

/**
 * Returns a list of available node type names.
 *
@@ -325,25 +248,6 @@ function node_type_get_description(NodeTypeInterface $node_type) {
  return $node_type->getDescription();
}

/**
 * Menu argument loader: Loads a node type by string.
 *
 * @param $name
 *   The machine name of a node type to load.
 *
 * @return \Drupal\node\NodeTypeInterface
 *   A node type object or NULL if $name does not exist.
 *
 * @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use
 *   \Drupal\node\Entity\NodeType::load().
 *
 * @see https://www.drupal.org/node/2266845
 */
function node_type_load($name) {
  @trigger_error('node_type_load() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\node\Entity\NodeType::load(). See https://www.drupal.org/node/2266845', E_USER_DEPRECATED);
  return NodeType::load($name);
}

/**
 * Adds the default body field to a node type.
 *
@@ -435,60 +339,6 @@ function node_type_update_nodes($old_id, $new_id) {
  return \Drupal::entityTypeManager()->getStorage('node')->updateType($old_id, $new_id);
}

/**
 * Loads node entities from the database.
 *
 * This function should be used whenever you need to load more than one node
 * from the database. Nodes are loaded into memory and will not require database
 * access if loaded again during the same page request.
 *
 * @param array $nids
 *   (optional) An array of entity IDs. If omitted, all entities are loaded.
 * @param bool $reset
 *   (optional) Whether to reset the internal node_load() cache.  Defaults to
 *   FALSE.
 *
 * @return \Drupal\node\NodeInterface[]
 *   An array of node entities indexed by nid.
 *
 * @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use
 *   \Drupal\node\Entity\Node::loadMultiple().
 *
 * @see https://www.drupal.org/node/2266845
 */
function node_load_multiple(array $nids = NULL, $reset = FALSE) {
  @trigger_error('node_load_multiple() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\node\Entity\Node::loadMultiple(). See https://www.drupal.org/node/2266845', E_USER_DEPRECATED);
  if ($reset) {
    \Drupal::entityTypeManager()->getStorage('node')->resetCache($nids);
  }
  return Node::loadMultiple($nids);
}

/**
 * Loads a node entity from the database.
 *
 * @param int $nid
 *   The node ID.
 * @param bool $reset
 *   (optional) Whether to reset the node_load_multiple() cache. Defaults to
 *   FALSE.
 *
 * @return \Drupal\node\NodeInterface|null
 *   A fully-populated node entity, or NULL if the node is not found.
 *
 * @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use
 *   \Drupal\node\Entity\Node::load().
 *
 * @see https://www.drupal.org/node/2266845
 */
function node_load($nid = NULL, $reset = FALSE) {
  @trigger_error('node_load() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\node\Entity\Node::load(). See https://www.drupal.org/node/2266845', E_USER_DEPRECATED);
  if ($reset) {
    \Drupal::entityTypeManager()->getStorage('node')->resetCache([$nid]);
  }
  return Node::load($nid);
}

/**
 * Loads a node revision from the database.
 *
@@ -844,60 +694,6 @@ function node_get_recent($number = 10) {
  return $nodes ? $nodes : [];
}

/**
 * Generates an array for rendering the given node.
 *
 * @param \Drupal\node\NodeInterface $node
 *   A node entity.
 * @param $view_mode
 *   (optional) View mode, e.g., 'full', 'teaser', etc. Defaults to 'full.'
 * @param $langcode
 *   (optional) A language code to use for rendering. Defaults to NULL which is
 *   the global content language of the current request.
 *
 * @return array
 *   An array as expected by \Drupal\Core\Render\RendererInterface::render().
 *
 * @deprecated in drupal:8.7.0 and is removed from drupal:9.0.0.
 *   Use \Drupal::entityTypeManager()->getViewBuilder('node')->view() instead.
 *
 * @see https://www.drupal.org/node/3033656
 */
function node_view(NodeInterface $node, $view_mode = 'full', $langcode = NULL) {
  @trigger_error("node_view() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \Drupal::entityTypeManager()->getViewBuilder('node')->view() instead. See https://www.drupal.org/node/3033656", E_USER_DEPRECATED);
  return \Drupal::entityTypeManager()
    ->getViewBuilder('node')
    ->view($node, $view_mode, $langcode);
}

/**
 * Constructs a drupal_render() style array from an array of loaded nodes.
 *
 * @param $nodes
 *   An array of nodes as returned by Node::loadMultiple().
 * @param $view_mode
 *   (optional) View mode, e.g., 'full', 'teaser', etc. Defaults to 'teaser.'
 * @param $langcode
 *   (optional) A language code to use for rendering. Defaults to the global
 *   content language of the current request.
 *
 * @return array
 *   An array in the format expected by
 *   \Drupal\Core\Render\RendererInterface::render().
 *
 * @deprecated in drupal:8.7.0 and is removed from drupal:9.0.0. Use
 *   \Drupal::entityTypeManager()->getViewBuilder('node')->viewMultiple()
 *   instead.
 *
 * @see https://www.drupal.org/node/3033656
 */
function node_view_multiple($nodes, $view_mode = 'teaser', $langcode = NULL) {
  @trigger_error("node_view_multiple() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \Drupal::entityTypeManager()->getViewBuilder('node')->viewMultiple() instead. See https://www.drupal.org/node/3033656", E_USER_DEPRECATED);
  return \Drupal::entityTypeManager()
    ->getViewBuilder('node')
    ->viewMultiple($nodes, $view_mode, $langcode);
}

/**
 * Implements hook_page_top().
 */
+0 −24
Original line number Diff line number Diff line
@@ -109,30 +109,6 @@ public function addPage() {
    return $build;
  }

  /**
   * Provides the node submission form.
   *
   * @param \Drupal\node\NodeTypeInterface $node_type
   *   The node type entity for the node.
   *
   * @return array
   *   A node submission form.
   *
   * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Define
   *   entity form routes through the _entity_form instead through the
   *   _controller directive.
   */
  public function add(NodeTypeInterface $node_type) {
    @trigger_error(__METHOD__ . ' is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Define entity form routes through the _entity_form instead through the _controller directive. See https://www.drupal.org/node/3084856', E_USER_DEPRECATED);
    $node = $this->entityTypeManager()->getStorage('node')->create([
      'type' => $node_type->id(),
    ]);

    $form = $this->entityFormBuilder()->getForm($node);

    return $form;
  }

  /**
   * Displays a node revision.
   *
+0 −32
Original line number Diff line number Diff line
@@ -255,22 +255,6 @@ public function setSticky($sticky) {
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getRevisionAuthor() {
    @trigger_error(__NAMESPACE__ . '\Node::getRevisionAuthor is deprecated in drupal:8.2.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\RevisionLogInterface::getRevisionUser() instead. See https://www.drupal.org/node/3069750', E_USER_DEPRECATED);
    return $this->getRevisionUser();
  }

  /**
   * {@inheritdoc}
   */
  public function setRevisionAuthorId($uid) {
    @trigger_error(__NAMESPACE__ . '\Node::setRevisionAuthorId is deprecated in drupal:8.2.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\RevisionLogInterface::setRevisionUserId() instead. See https://www.drupal.org/node/3069750', E_USER_DEPRECATED);
    return $this->setRevisionUserId($uid);
  }

  /**
   * {@inheritdoc}
   */
@@ -378,20 +362,4 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
    return $fields;
  }

  /**
   * Default value callback for 'uid' base field definition.
   *
   * @see ::baseFieldDefinitions()
   *
   * @deprecated The ::getCurrentUserId method is deprecated in 8.6.x and will
   *   be removed before 9.0.0.
   *
   * @return array
   *   An array of default values.
   */
  public static function getCurrentUserId() {
    @trigger_error('The ::getCurrentUserId method is deprecated in 8.6.x and will be removed before 9.0.0.', E_USER_DEPRECATED);
    return [\Drupal::currentUser()->id()];
  }

}
+0 −8
Original line number Diff line number Diff line
@@ -121,14 +121,6 @@ public function isLocked() {
    return isset($locked[$this->id()]) ? $locked[$this->id()] : FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function isNewRevision() {
    @trigger_error('NodeType::isNewRevision is deprecated in drupal:8.3.0 and is removed from drupal:9.0.0. Use Drupal\Core\Entity\RevisionableEntityBundleInterface::shouldCreateNewRevision() instead. See https://www.drupal.org/node/3067365', E_USER_DEPRECATED);
    return $this->shouldCreateNewRevision();
  }

  /**
   * {@inheritdoc}
   */
+0 −24
Original line number Diff line number Diff line
@@ -209,30 +209,6 @@ public function form(array $form, FormStateInterface $form_state) {
    return $form;
  }

  /**
   * Entity builder updating the node status with the submitted value.
   *
   * @param string $entity_type_id
   *   The entity type identifier.
   * @param \Drupal\node\NodeInterface $node
   *   The node updated with the submitted values.
   * @param array $form
   *   The complete form array.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   *
   * @see \Drupal\node\NodeForm::form()
   *
   * @deprecated in drupal:8.4.0 and is removed from drupal:9.0.0.
   *   The "Publish" button was removed.
   */
  public function updateStatus($entity_type_id, NodeInterface $node, array $form, FormStateInterface $form_state) {
    $element = $form_state->getTriggeringElement();
    if (isset($element['#published_status'])) {
      $element['#published_status'] ? $node->setPublished() : $node->setUnpublished();
    }
  }

  /**
   * {@inheritdoc}
   */
Loading