You are here

function template_preprocess_foundation_tabs in ZURB Section 7

Implements template_preprocess_foundation_tabs().

Parameters

$variables:

File

./foundation_group.module, line 201

Code

function template_preprocess_foundation_tabs(&$variables) {
  $variables['tab_row_classes'] = $variables['group']->classes;
  if (preg_match('/contained/', $variables['group']->classes)) {
    $variables['tab_content_classes'] = 'contained';
  }
  foreach ($variables['items'] as $key => $item) {
    $variables['tab_parents'][] = array(
      'title' => l(check_plain($item['#title']), NULL, array(
        'fragment' => $item['#attributes']['id'],
        'external' => TRUE,
      )),
    );
    $variables['tab_children'][] = array(
      'id' => _foundation_group_convert_label_to_tab_id($item['#title'], TRUE),
      'content' => drupal_render($item),
      'class' => implode(' ', $item['#attributes']['class']),
    );
  }

  // defaults
  if (count($variables['tab_parents'])) {
    $variables['tab_parents'][0]['class'] = 'active';
  }
  if (count($variables['tab_children'])) {
    $variables['tab_children'][0]['class'] .= ' active';
  }
  if (count($variables['tab_parents']) && count($variables['tab_children'])) {
    $variables['has_tabs'] = TRUE;
  }
}