For now, only allow nodes to use `ContentTemplateAwareViewBuilder`
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3543449. -->
Reported by: [phenaproxima](https://www.drupal.org/user/205645)
Related to !85
>>>
<h3 id="overview">Overview</h3>
<p>Drupal CMS just ran into a nasty bug where submitting a webform dies with a fatal error if XB is installed, because:</p>
<pre>Error: Call to undefined method Drupal\experience_builder\EntityHandlers\ContentTemplateAwareViewBuilder::buildElements() in _webform_token_get_submission_values() (line 250 of modules/contrib/webform/webform.tokens.inc). </pre><p>It turns out that the view builder for webform_submission content entities implements a special interface specific to Webform (<code>\Drupal\webform\WebformSubmissionViewBuilderInterface</code>), which XB doesn't check for (and wouldn't be able to do anything about if it did).</p>
<p>Steps to reproduce:</p>
<ol>
<li>Install Webform and <del>XB</del> Canvas.</li>
<li>Create a webform, any webform. Visit it at its own page, while logged in with permission to view webform submissions.</li>
<li>Submit it with random, valid values.</li>
</ol>
<p>If Webform tries to redirect you to the rendered submission, it will break because the view builder no longer has methods that Webform expects it to have.</p>
<h3 id="proposed-resolution">Proposed resolution</h3>
<p><del>XB should respect a <code>supports_content_templates</code> flag on the entity type definition. It should default to TRUE, but if it's FALSE, XB should not change its view builder, even if the entity type otherwise checks all the boxes that would be needed for it to use content templates. This would give Webform a way to prevent horrible breakages in the short term, while giving it the leeway it needs to properly integrate with content templates (if, indeed, it ever decides to support them for webform submissions).</del></p>
<p>For now we are hard-coding <code>node</code> when assigning the view builder handler to entity type definitions. We'll refine in <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3498525" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3498525</a></span></p>
> Related issue: [Issue #3518013](https://www.drupal.org/node/3518013)
issue