You are here

function template_preprocess_panels_add_content_modal in Panels 7.3

Preprocess the primary entry level theme.

File

includes/add-content.inc, line 11
Contains template preprocess files for the add content modal themes.

Code

function template_preprocess_panels_add_content_modal(&$vars) {
  $vars['categories_array'] = array();

  // Process the list of categories.
  foreach ($vars['categories'] as $key => $category_info) {

    // 'root' category is actually displayed under the categories, so
    // skip it.
    if ($key == 'root') {
      continue;
    }
    $class = 'panels-modal-add-category';
    if ($key == $vars['category']) {
      $class .= ' active';
    }
    $url = $vars['renderer']
      ->get_url('select-content', $vars['region'], $key);
    $vars['categories_array'][] = ctools_ajax_text_button($category_info['title'], $url, '', $class);
  }

  // Now render the top level buttons (aka the root category) if any.
  $vars['root_content'] = '';
  if (!empty($vars['categories']['root'])) {
    foreach ($vars['categories']['root']['content'] as $content_type) {
      $vars['root_content'] .= theme('panels_add_content_link', array(
        'renderer' => $vars['renderer'],
        'region' => $vars['region'],
        'content_type' => $content_type,
      ));
    }
  }
}