I’d like to change the output from the field formatter view from the Field API. I’d like a cleaner markup without unnecessary tags. What’s the best way to clean up field formatter view output? Many thanks.
Ideally to change from this:
<div class="field field--name-field-visualisation field--type-mango-maker field--label-above"> <div class="field__label">Visualisation: </div> <div class="field__items"> <div class="field__item even"> <div class="something"></div> </div> </div> </div>
to this:
<div class="field field--name-field-visualisation field--type-mango-maker field--label-above"> <div class="field__label">Visualisation: </div> <div class="something"></div> </div>
heres my hook_function_field_formatter_view function:
function mango_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) { $output[0] = array( '#theme' => 'container', '#attributes' => array( 'class' => array('something'), ), ); return $output; }