I am trying to produce a result that requires PHP code to evaluate whether a Drupal 8 node field is a "x", an "f", a "m", a "h", or an "l".
Thanks to some help on an earlier question, I've accomplished my task (to replace the value with a useful icon) when the value is binary: if it exists, show this. If it's empty, show nothing. I've done this via CSS.
Now I'd like to extract the actual value of the node field, and display different icons based on its value.
I am not planning to do this via a function, but rather by code on the node itself. Is there some syntax I can use within the php that will extract this? So that I can have the equivalent of:
$price = $node[field][value];
then I'd do:
if ($price == "m") { // use icon X }
else if ($price == "h") { // use icon Y };
Thank you for any and all help/suggestions!