1.20.x system.theme.inc system_preprocess_page_components(&$variables)

Prepares variables for Page Component block templates.

File

modules/system/system.theme.inc, line 743
Theme functions for the System module.

Code

function system_preprocess_page_components(&$variables) {
  $settings = $variables['settings'];
  $child_delta = $variables['child_delta'];
  $variables += array(
    'action_links' => NULL,
    'tabs' => NULL,
    'messages' => NULL,
    'title' => NULL,
  );

  if ($child_delta == 'title' || $child_delta == 'title_combo') {
    $variables['title'] = $settings['title'];
    $variables['title_tag'] = $settings['title_tag'];
    $variables['title_classes'] = $settings['title_classes'];
    $variables['title_attributes'] = array(
      'class' => array_filter(explode(' ', $settings['title_classes'])),
    );
  }
  if ($child_delta == 'tabs' || $child_delta == 'title_combo') {
    $menus = array();
    switch ($settings['tab_type']) {
      case 'primary':
        $menus = array(
          'primary' => menu_primary_local_tasks(),
        );
        break;
      case 'secondary':
        $menus = array(
          'secondary' => menu_secondary_local_tasks(),
        );
        break;
      case 'both':
        $menus = array(
          'primary' => menu_primary_local_tasks(),
          'secondary' => menu_secondary_local_tasks(),
        );
        break;
    }
    if ($settings['tab_type'] == 'hidden') {
      $variables['tabs'] = '';
    }
    else {
      $variables['tabs'] = theme('menu_local_tasks', $menus);
    }
  }
  if ($child_delta == 'action_links' || $child_delta == 'title_combo') {
    $variables['action_links'] = menu_local_actions();
  }

  if ($child_delta == 'messages' || $child_delta == 'title_combo') {
    $variables['messages'] = theme('status_messages');
  }

  // Add specific suggestions that can override the default implementation.
  $variables['theme_hook_suggestions'] = array(
    'page_components__' . $child_delta,
  );
}