How to print an entity bundle field from one with multiple values Struggling to find the answer to this. I have an entity called "school objects" which has a bundle called "homepage". One of the fields attached to this is called "Hero banners" and it allows multiple text values.



All I want to do is print each value. I don't need to check for conditions, I don't need NIDs, I just want each value. I am not really a php developer but understand the basics of what it is doing. I was looking into the EntityFieldQuery code, but cannot get anything to print on a tpl file I am using.

The output I need, based on image attached, is simply:

&lt;div class="value_1"&gt;images/symbol.png&lt;/div&gt;
&lt;div class="value_2"&gt;Let's make a difference&lt;/div&gt;
&lt;div class="value_3"&gt;Start today&lt;/div&gt;


All I can find after a lot of searching is complex bits of code checking for conditions and stuff that I do not need. I need some kind of array I think so that my template looks like:

&lt;div class="value_1"&gt;Value[0]&lt;/div&gt;
&lt;div class="value_2"&gt;Value[1]&lt;/div&gt;
&lt;div class="value_3"&gt;Value[2]&lt;/div&gt;


All I got so far is this:

query = new EntityFieldQuery();
$query-&gt;entityCondition('entity_type', 'school_objects')
  -&gt;entityCondition('bundle', 'homepage')
  -&gt;range(0, 14);
$result = $query-&gt;execute();


I have read the link to this on the Drupal site but cannot understand it or how to print what I need.
Try the following and load the actual entity to get its field values.

The code assumes you have drupals entityTypeManager injected via dependency injection. Otherwise use \Drupal::entityTypeManager() isntead of $this-&gt;entityTypeManager()

// Get the entity ids.
$entityIds = $this-&gt;entityTypeManager()-&gt;getStorage('school_objects')-&gt;getQuery()
  -&gt;condition('type', 'homepage')
  // Add more conditions if you need.
  -&gt;execute();
// I assume only one id is returned and reset the array. Otherwise go over 
// each Id with a foreach() and do this in a loop.
$entityId = reset($entityIds);
$schoolObject = $this-&gt;entityTypeManager()-&gt;getStorage('school_objects')-&gt;load($entityId);
// Now get the values of your field. I assume the fields machine_name is 'field_hero_banners'. Adjust if needed.
$values = $schoolObject-&gt;get('field_hero_banners')-&gt;getValue()
// Loop over all values.
foreach ($values as $item) {
  $value = $item['value'];
}