I want to render a node’s field inside a block. It works like this:
<?php if ($node) { if (isset($node->field_body_secondary) && $field = $node->field_body_secondary->value) { $markup = render($field); $build = array( '#type' => 'markup', '#markup' => $markup, ); } } return $build;
But this is not 100% as if I would just render the field normally, making it visible in the view mode settings.