Drupal 8 Changes
<?php
// @ see https://www.drupal.org/list-changes
// NODE_LOAD / USER_LOAD
// Drupal 7
$node = node_load(1);
$node = user_load_multiple(array(1, 2, 3));
// Drupal 8
// Long way
use \Drupal\node\Entity\Node;
use \Drupal\user\Entity\User;
$node = Node::load($nid);
$users = User::loadMultiple($user_ids_array);
// Short way
$node = \Drupal\node\Entity\Node::load($nid);
$users = \Drupal\user\Entity\User::loadMultiple($user_ids_array);
// Get image from field
// Get image uri
if (isset(node->field_image)) {
$img_uri = node->field_image[0]->entity->uri->value;
// Get full path to image using image style
$img_src = \Drupal\image\Entity\ImageStyle::load('thumbnail')->buildUrl($img_uri);
}
else {
$img_src = '';
}
?>