On February 29, 2020 . By CodimTh Category: Web Drupal Code snippet that can be used to access to field value for an node in drupal 8. Example: $node = \Drupal::entityTypeManager()->getStorage('node')->load($nid); $body = $node->get('body')->getValue(); $title = $node->get('title')->getString(); $title = $node->get('title')->value; Tags : Drupal 8 Snippets Previous PostGetting and setting configuration data in Drupal 8Next PostAdding Theme Suggestions Programmatically For Tables in drupal 8 Comments Add new comment Your name Subject Comment About text formats Restricted HTML Leave this field blank
Comments