Remove fieldset on a date field Drupal 7

For some reason you want to display the date field without the fieldset wrapper, it’s not difficult but it may take you time to notice that the theme function called is in the date.theme file (date module) :

 * Returns HTML for a start/end date combination on form.
function theme_date_combo($variables) {
  $element = $variables['element'];
  $field = field_info_field($element['#field_name']);
  $instance = field_info_instance($element['#entity_type'], $element['#field_name'], $element['#bundle']);
  // Group start/end items together in fieldset.
  $fieldset = array(
    '#title' => t($element['#title']) . ' ' . ($element['#delta'] > 0 ? intval($element['#delta'] + 1) : ''),
    '#value' => '',
    '#description' => !empty($element['#fieldset_description']) ? $element['#fieldset_description'] : '',
    '#attributes' => array(),
    '#children' => $element['#children'],
  return theme('fieldset', array('element' => $fieldset));

So to override the funtion and change the render of the field put this code in the template.php file of your theme :

 * Render date field without fieldset
function MYTHEME_date_combo($variables) {
  return theme('form_element', $variables);

Nice coding!


Show drupal status messages in omega theme region

I had to include the render of the drupal status messages ($messages) in the “region–content.tpl.php” template.

$messages is not available in regions (its a page variable, not a region variable). For Omega it is also a zone variable,

by default it is available in “zone–content.tpl.php”, to make it available for regions i had to add $messages via hook_region_process :

 * Implements hook_process_region().
function mytheme_process_region(&$vars) {
  $theme = alpha_get_theme();
  if ($vars['elements']['#region'] == 'content') {
    $vars['messages'] = $theme->page['messages'];

Than create a “region–content.tpl.php” which will contain :

<div<?php print $attributes; ?>>
  <div<?php print $content_attributes; ?>>
    <?php if ($messages): ?>
      <div id="messages" class=""><?php print $messages; ?></div>
    <?php endif; ?>
    <a id="main-content"></a>
    <?php print render($title_prefix); ?>
    <?php if ($title): ?>
    <?php if ($title_hidden): ?><div class="element-invisible"><?php endif; ?>
    <h1 class="title" id="page-title"><?php print $title; ?></h1>
    <?php if ($title_hidden): ?></div><?php endif; ?>
    <?php endif; ?>
    <?php print render($title_suffix); ?>
    <?php if ($tabs && !empty($tabs['#primary'])): ?><div class="tabs clearfix"><?php print render($tabs); ?></div><?php endif; ?>
    <?php if ($action_links): ?><ul class="action-links"><?php print render($action_links); ?></ul><?php endif; ?>
    <?php print $content; ?>
    <?php if ($feed_icons): ?><div class="feed-icon clearfix"><?php print $feed_icons; ?></div><?php endif; ?>

Hope this will be useful!