Skip to main content
added 61 characters in body; edited title
Source Link
norman.lol
  • 19.1k
  • 6
  • 75
  • 130

How to get nid and title from a node array structure in Drupal 8 as given below?

use Drupal\node\Entity\Node;   function abc($v) {   $node = \Drupal\node\Entity\Node::load($v);  print_r($node); } 

The array structure of $node is as given below

Drupal\node\Entity\Node Object ( [in_preview] => [values:protected] => Array ( [nid] => Array ( [x-default] => 166 ) [vid] => Array ( [x-default] => 180 ) [type] => Array ( [x-default] => sections ) [uuid] => Array ( [x-default] => 7759efc9-cfff-4d58-b392-8d60b9903323 ) [langcode] => Array ( [x-default] => en ) 
Drupal\node\Entity\Node Object ( [in_preview] => [values:protected] => Array ( [nid] => Array ( [x-default] => 166 ) [vid] => Array ( [x-default] => 180 ) [type] => Array ( [x-default] => sections ) [uuid] => Array ( [x-default] => 7759efc9-cfff-4d58-b392-8d60b9903323 ) [langcode] => Array ( [x-default] => en ) 

How to get nid and title from node array structure in Drupal 8 as given below?

use Drupal\node\Entity\Node; function abc($v){   $node = \Drupal\node\Entity\Node::load($v); print_r($node); } 

The array structure of $node is as given below

Drupal\node\Entity\Node Object ( [in_preview] => [values:protected] => Array ( [nid] => Array ( [x-default] => 166 ) [vid] => Array ( [x-default] => 180 ) [type] => Array ( [x-default] => sections ) [uuid] => Array ( [x-default] => 7759efc9-cfff-4d58-b392-8d60b9903323 ) [langcode] => Array ( [x-default] => en ) 

How to get nid and title from a node array

use Drupal\node\Entity\Node;   function abc($v) { $node = \Drupal\node\Entity\Node::load($v);  print_r($node); } 

The array structure of $node is as given below

Drupal\node\Entity\Node Object ( [in_preview] => [values:protected] => Array ( [nid] => Array ( [x-default] => 166 ) [vid] => Array ( [x-default] => 180 ) [type] => Array ( [x-default] => sections ) [uuid] => Array ( [x-default] => 7759efc9-cfff-4d58-b392-8d60b9903323 ) [langcode] => Array ( [x-default] => en ) 
Source Link
harshal
  • 4.4k
  • 7
  • 43
  • 84

How to get nid and title from node array structure in Drupal 8 as given below?

use Drupal\node\Entity\Node; function abc($v){ $node = \Drupal\node\Entity\Node::load($v); print_r($node); } 

The array structure of $node is as given below

Drupal\node\Entity\Node Object ( [in_preview] => [values:protected] => Array ( [nid] => Array ( [x-default] => 166 ) [vid] => Array ( [x-default] => 180 ) [type] => Array ( [x-default] => sections ) [uuid] => Array ( [x-default] => 7759efc9-cfff-4d58-b392-8d60b9903323 ) [langcode] => Array ( [x-default] => en )