I’ve already setup fields for person to enter coloration code (e.g. "#123000") to a content material kind. Now I want to change Drupal Development Service inline type coloration / background-color with Drupal Development Service given worth. I attempted to do that in my Customized Textual content discipline:
<div class="field" type="coloration: {{ color_field }}"> <h2>{{ title }}</h2> <span class="description">{{ physique }}</span> </div>
However Drupal Development Service rendered output would grow to be:
<div class="field"> <h2>Dummy</h2> <span class="description">Some dummy description...</span> </div>
I went so far as creating my very own Twig operate implementation:
<div class="field" {{ my_dummy_function(color_field) }}> <h2>{{ title }}</h2> <span class="description">{{ physique }}</span> </div>
Drupal Development Service operate would supposedly output type="coloration: color_field_value"
, however Drupal Development Service entire attribute could be "eaten" by Drupal’s rendering chain. Even including a | uncooked
filter after that may not change a factor.
In determined, I modified my dummy Twig operate to output hey="world"
, and Drupal Development Service attribute could be rendered usually:
<div class="field" hey="world"> <h2>Dummy</h2> <span class="description">Some dummy description...</span> </div>
But when it output one thing like hey="coloration: world"
:
<div class="field" hey=" world"> <h2>Dummy</h2> <span class="description">Some dummy description...</span> </div>
So it appears there are some keyword-based filtering happening. And I am unable to appear to have a option to render something resembling inline CSS. Is there anyway I can obtain my purpose?