$settings->get('enable_darkmode') can cause WSOD
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3511415. -->
Reported by: [jurgenhaas](https://www.drupal.org/user/168924)
Related to !596
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>My edge case is that I have Gin as the frontend theme and Claro as the backend theme. Yes, I know this is crazy, and I've only switched to Claro temporarily to test something, ensuring that a render issue in views is not caused by Gin.</p>
<p>But this crazy scenario exposed a tiny issue that can easily be resolved. In <code>gin_page_attachments_alter</code> we call this:</p>
<div class="codeblock">
<pre><span style="color: #000000"><span style="color: #0000BB"><?php<br></span><span style="color: #DD0000">'#value' </span><span style="color: #007700">=> new </span><span style="color: #0000BB">FormattableMarkup</span><span style="color: #007700">(</span><span style="color: #DD0000">'{ "ginDarkmode": "@value" }'</span><span style="color: #007700">, [</span><span style="color: #DD0000">'@value' </span><span style="color: #007700">=> </span><span style="color: #0000BB">$settings</span><span style="color: #007700">-></span><span style="color: #0000BB">get</span><span style="color: #007700">(</span><span style="color: #DD0000">'enable_darkmode'</span><span style="color: #007700">)]),<br></span><span style="color: #0000BB">?></span></span></pre></div>
<p>In the scenario above, the setting returns NULL which will later be passed on to <code>\Drupal\Component\Utility\Html::escape</code> and that throws an exception because the given text has to be string and can't be NULL.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Provide a default value in this case.</p>
> Related issue: [Issue #3506992](https://www.drupal.org/node/3506992)
issue