Eliminate the need for $cacheable_metadata passed to buildEntities and similar methods
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3577082. -->
Reported by: [baysaa](https://www.drupal.org/user/1358394)
Related to !49
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Initializing and passing and applying $cacheable_metadata during view mode builders just to avoid caching issues can be tedious at best. I am looking into different ways we could cleanly eliminate this so there's a clean upgrade path from 1.1.20 to 2.0.0, as well as eliminate the caching bug that prompted the introduction of this new parameter.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p> 1. Add protected CacheableMetadata $cacheableMetadata to EntityViewBuilderPluginAbstract, initialize + apply it in build()<br>
2. Strip $cacheable_metadata param from the 4 BuildFieldTrait methods; use $this->cacheableMetadata<br>
3. Clean up the 3 plugin files</p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<p>Needs review</p>
<h3 id="summary-ui-changes">User interface changes</h3>
<p>None</p>
issue