I am currently struggling to alter the output of a field inside a specific view template. I have a Taxonomy term I want to render using a <h3> over the default <div> that Views default gives us, and to accomplish this a Field template needs to be implemented, that encapsulates this field with said <h3>.
Okay, not a problem. But when I work with the template's row output, it gets hairy. I can't find a catch-all print statement that drills down into the field (which is a taxonomy term value) and retrieves the #title attribute.
$data = $row->{'field_field_article_type'};
print_r($data);
The Print_R of the $data, which itself polls the field inside each row statement is as follows:
Array
(
[0] => Array
(
[rendered] => Array
(
[#type] => link
[#title] => Health
[#href] => taxonomy/term/18
[#options] => Array
(
[entity_type] => taxonomy_term
[entity] => stdClass Object
(
[tid] => 18
[vid] => 3
[name] => Health
[description] =>
[format] =>
[weight] => 0
[vocabulary_machine_name] => content
[rdf_mapping] => Array
(
[rdftype] => Array
(
[0] => skos:Concept
)
[name] => Array
(
[predicates] => Array
(
[0] => rdfs:label
[1] => skos:prefLabel
)
)
[description] => Array
(
[predicates] => Array
(
[0] => skos:definition
)
)
[vid] => Array
(
[predicates] => Array
(
[0] => skos:inScheme
)
[type] => rel
)
[parent] => Array
(
[predicates] => Array
(
[0] => skos:broader
)
[type] => rel
)
)
)
[attributes] => Array
(
[typeof] => typeof="skos:Concept"
[property] => property="rdfs:label skos:prefLabel"
[datatype] =>
)
)
[#access] => 1
[#printed] => 1
[#pre_render] => Array
(
[0] => drupal_pre_render_link
[1] => drupal_pre_render_markup
)
[#markup] =>
I've tried a few variations to access the variable, but it typically returns null and with the mix of StdClasses and Arrays, its becoming tumultuous to access.
Does anyone here know any surefire ways to theme a field output? Am I going about this in the wrong manner? Should I alter an additional theme call in Views to accomplish this simple goal?