Skip to main content
improved formatting
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

Depending onThe code to use depends from the version of Drupal :version.

drupal 6:

Drupal 6

$nodes = db_query('SELECT nid FROM {node} WHERE type="%s"', $type);

$nodes = db_query('SELECT nid FROM {node} WHERE type="%s"', $type);

drupal 7:

Drupal 7

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

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

drupal 8:

Drupal 8

$nids = \Drupal::entityQuery('node')
  ->condition('type', 'NODETYPE')
  ->execute();
$nodes = \Drupal::entityTypeManager()
  ->getStorage('node')
  ->loadMultiple($nids);
$nids = \Drupal::entityQuery('node')
  ->condition('type', 'NODETYPE')
  ->execute();
$nodes = \Drupal::entityTypeManager()
  ->getStorage('node')
  ->loadMultiple($nids);

Depending on the version of Drupal :

drupal 6:

$nodes = db_query('SELECT nid FROM {node} WHERE type="%s"', $type);

drupal 7:

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

drupal 8:

$nids = \Drupal::entityQuery('node')
  ->condition('type', 'NODETYPE')
  ->execute();
$nodes = \Drupal::entityTypeManager()
  ->getStorage('node')
  ->loadMultiple($nids);

The code to use depends from the Drupal version.

Drupal 6

$nodes = db_query('SELECT nid FROM {node} WHERE type="%s"', $type);

Drupal 7

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

Drupal 8

$nids = \Drupal::entityQuery('node')
  ->condition('type', 'NODETYPE')
  ->execute();
$nodes = \Drupal::entityTypeManager()
  ->getStorage('node')
  ->loadMultiple($nids);
Change concrete node type to uppercase
Source Link
Nikit
  • 4k
  • 1
  • 20
  • 27

Depending on the version of Drupal :

drupal 6:

$nodes = db_query('SELECT nid FROM {node} WHERE type="%s"', $type);

drupal 7:

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

drupal 8:

$nids = \Drupal::entityQuery('node')
  ->condition('type', 'student_vote''NODETYPE')
  ->execute();
$nodes = \Drupal::entityTypeManager()
  ->getStorage('node')
  ->loadMultiple($nids);

Depending on the version of Drupal :

drupal 6:

$nodes = db_query('SELECT nid FROM {node} WHERE type="%s"', $type);

drupal 7:

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

drupal 8:

$nids = \Drupal::entityQuery('node')
  ->condition('type', 'student_vote')
  ->execute();
$nodes = \Drupal::entityTypeManager()
  ->getStorage('node')
  ->loadMultiple($nids);

Depending on the version of Drupal :

drupal 6:

$nodes = db_query('SELECT nid FROM {node} WHERE type="%s"', $type);

drupal 7:

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

drupal 8:

$nids = \Drupal::entityQuery('node')
  ->condition('type', 'NODETYPE')
  ->execute();
$nodes = \Drupal::entityTypeManager()
  ->getStorage('node')
  ->loadMultiple($nids);

WhatDepending on the version of drupal?
drupal 6:Drupal :

drupal 6:

$nodes = db_query('SELECT nid FROM {node} WHERE type="%s"', $type);
drupal 7:

drupal 7:

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

drupal 8:

$nids = \Drupal::entityQuery('node')
  ->condition('type', 'student_vote')
  ->execute();
$nodes = \Drupal::entityTypeManager()
  ->getStorage('node')
  ->loadMultiple($nids);

What version of drupal?
drupal 6: $nodes = db_query('SELECT nid FROM {node} WHERE type="%s"', $type);
drupal 7: $nodes = node_load_multiple(array(), array('type' => $type));
 

Depending on the version of Drupal :

drupal 6:

$nodes = db_query('SELECT nid FROM {node} WHERE type="%s"', $type);

drupal 7:

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

drupal 8:

$nids = \Drupal::entityQuery('node')
  ->condition('type', 'student_vote')
  ->execute();
$nodes = \Drupal::entityTypeManager()
  ->getStorage('node')
  ->loadMultiple($nids);
Post Migrated Here from stackoverflow.com (revisions)
Source Link
Nikit
  • 4k
  • 1
  • 20
  • 27
Loading