Field labels can be hidden for a content type by going to "Manage display" and changing the labels to hidden.
However, I rarely need to show labels.
Is there a way to have the labels hidden by default, site-wide?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI think preprocess_node should do the trick
use that in your template.php
function template_preprocess_node(&$vars){
//Supposing that your content type name is "group"
if($vars['type'] == 'your type'){
$vars['content']['your_field']['#title'] = '';
}
}
Use hook_field_create_instance() to hide content type labels by default.
<?php
// implementation of hook_field_create_instance()
// sets all labels to Hidden for new fields
function MODULENAME_field_create_instance($instance){
// fetch the instance info
$instance_info = field_info_instance(
$instance['entity_type'],
$instance['field_name'],
$instance['bundle']
);
// set label in each display to hidden
foreach( $instance_info['display'] as &$display ){
$display['label'] = 'hidden';
}
// save back to disk
field_update_instance($instance_info);
}
?>