How do I get a plaintext list of tags from a multi value entity reference field? I have a module that's making custom RSS feeds for me.

In a content type, I have my tags stored in "field_tags" entity reference field.

My goal is to get the names of all the tags, and ultimately put them into an array, so they can go into a markupless  RSS field.

When I'm pulling the data, I get it with this:

foreach ($this-&gt;dbh-&gt;selectVideos(self::RPP) as $nid) {
  $node = $this-&gt;entityMgr-&gt;getStorage('node')-&gt;load($nid);

  if (!empty($node)) {
    $data-&gt;nodes[] = [
      'title'    =&gt; $this-&gt;filterTxt($node-&gt;title-&gt;value),
      'body'     =&gt; $this-&gt;filterTxt($node-&gt;get('field_paragraph')-&gt;value),
      'body2'     =&gt; $this-&gt;filterTxt($node-&gt;get('field_paragraph')-&gt;value),
      'created'  =&gt; date('D, d M Y H:i:s', $node-&gt;created-&gt;value) . ' GMT',
      'guid'     =&gt; $node-&gt;id(),
      'img'      =&gt; $this-&gt;getImgUrl($node, self::IMG_FIELD),
      'keywords' =&gt; $this-&gt;filterTxt($node-&gt;get('field_tags')-&gt;value),
      'video'    =&gt; $node-&gt;get('field_vid_url')-&gt;getString(),
    ];
  }
}
return $this-&gt;render($data, 'nameoffeed');


}

The problem is that 'field_tags' is an entity reference field, so it's turning up blank. 

I had partial success with this:

    if ($node-&gt;hasField('field_tags')){
      $entity_ref = $node-&gt;get('field_tags');
      if ($entity_ref-&gt;count() &gt; 0){
        $tagoutput = entity_view($entity_ref-&gt;entity, 'default');
      }


Then setting 'keywords' to equal $tagoutput. This grabs the first tag, which isn't great as I need them all, and then along with it comes a whole html layout enclosure that won't work for an RSS feed.

I'm confused what the correct way is to get a proper list of tag names. In D6 I had this list as plain text, which wasn't great because you wouldn't be able to click on one in the page view and be taken to a list of all pages with that tag, but at least the tags worked on the feeds easily.

Any thoughts?
You can get the array of reference entities from node using 


  $node->get('field_tags')->referencedEntities();


So the code will look something like below:

// Get the referenced entities
$tags = $node-&gt;get('field_tags')-&gt;referencedEntities();
// Check if we have output. (Assuming we get an array, You will have to check what your output it.)
if (!empty($tags)) {
  // Go through each entity.
  foreach ($tags as $tag) {
    // Write your Business Logic here to create your Keywords Array.
  }
}
// Use the Keywords Array for further use.


I Hope this helps you.