Skip to main content
deleted 2 characters in body
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

At the end, Drupal 8 deprecated functions like node_load_multiple(), user_load_multiple(), not just the $conditions parameter they used. This means thatit isn't possible to write Drupal 7 code that is compatible with Drupal 8, as the classes used in Drupal 8 aren't available on Drupal 7.

Drupal 7 code can still use node_load_multiple() and its $conditions parameter. To load all the nodes whose content type is $content_type, it's sufficient to use the following code.

$nodes = node_load_multiple(array(), array('type' => $content_type));

A more generic code that works for any entity would be the following one.

$entities = entity_load($entity_type, array(), array('type' => $bundle);

Despite the name, entity_load() loads more entities. It's the function used from node_load_multiple().

function node_load_multiple($nids = array(), $conditions = array(), $reset = FALSE) {
  return entity_load('node', $nids, $conditions, $reset);
}

At the end, Drupal 8 deprecated functions like node_load_multiple(), user_load_multiple(), not just the $conditions parameter they used. This means that isn't possible to write Drupal 7 code that is compatible with Drupal 8, as the classes used in Drupal 8 aren't available on Drupal 7.

Drupal 7 code can still use node_load_multiple() and its $conditions parameter. To load all the nodes whose content type is $content_type, it's sufficient to use the following code.

$nodes = node_load_multiple(array(), array('type' => $content_type));

A more generic code that works for any entity would be the following one.

$entities = entity_load($entity_type, array(), array('type' => $bundle);

Despite the name, entity_load() loads more entities. It's the function used from node_load_multiple().

function node_load_multiple($nids = array(), $conditions = array(), $reset = FALSE) {
  return entity_load('node', $nids, $conditions, $reset);
}

At the end, Drupal 8 deprecated functions like node_load_multiple(), user_load_multiple(), not just the $conditions parameter they used. This means it isn't possible to write Drupal 7 code that is compatible with Drupal 8, as the classes used in Drupal 8 aren't available on Drupal 7.

Drupal 7 code can still use node_load_multiple() and its $conditions parameter. To load all the nodes whose content type is $content_type, it's sufficient to use the following code.

$nodes = node_load_multiple(array(), array('type' => $content_type));

A more generic code that works for any entity would be the following one.

$entities = entity_load($entity_type, array(), array('type' => $bundle);

Despite the name, entity_load() loads more entities. It's the function used from node_load_multiple().

function node_load_multiple($nids = array(), $conditions = array(), $reset = FALSE) {
  return entity_load('node', $nids, $conditions, $reset);
}
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

At the end, Drupal 8 deprecated functions like node_load_multiple(), user_load_multiple(), not just the $conditions parameter they used. This means that isn't possible to write Drupal 7 code that is compatible with Drupal 8, as the classes used in Drupal 8 aren't available on Drupal 7.

Drupal 7 code can still use node_load_multiple() and its $conditions parameter. To load all the nodes whose content type is $content_type, it's sufficient to use the following code.

$nodes = node_load_multiple(array(), array('type' => $content_type));

A more generic code that works for any entity would be the following one.

$entities = entity_load($entity_type, array(), array('type' => $bundle);

Despite the name, entity_load() loads more entities. It's the function used from node_load_multiple().

function node_load_multiple($nids = array(), $conditions = array(), $reset = FALSE) {
  return entity_load('node', $nids, $conditions, $reset);
}