1.20.x installer.theme.inc template_preprocess_installer_browser_list(&$variables)

Add some variables for the projects list theme.

Parameters

$variables: An associative array containing:

  • projects_list : array of all projects.

File

modules/installer/installer.theme.inc, line 63
Project Installer theme pages.

Code

function template_preprocess_installer_browser_list(&$variables) {
  module_load_include('inc', 'installer', 'installer.browser');
  backdrop_add_css(backdrop_get_path('module', 'installer') . '/css/installer.css');

  if (is_array($variables['projects_list']) && !empty($variables['projects_list'])) {
    $content = '';
    $rows = array();
    switch ($variables['type']) {
      case 'module':
        $title = t('Modules');
        break;
      case 'theme':
        $title = t('Themes');
        break;
      case 'layout':
        $title = t('Layouts');
        break;
      default:
        $title = t('Projects');
        break;
    }
    $headers = array(
      $title,
    );
    // Theme each individual project and add to the list.
    $repository_list = installer_browser_get_server_list();
    foreach ($variables['projects_list'] as $project) {
      $row = array();
      $row[] = theme('installer_browser_project', array('project' => $project, 'first' => NULL, 'repository' => $repository_list[$project['source']]));
      $rows[] = $row;
    }
    $content .= theme('table', array('header' => $headers, 'rows' => $rows));
  }
  else {
    $content = t('No results found.');
  }

  $variables['main_content'] = render($content);

  // Add the pager.
  $variables['pager'] = theme('pager', array('tags' => NULL));

  // Add the install list.
  $install_list['installer_browser_install_list_block'] = array(
    '#theme' => 'installer_browser_block',
    '#title' => t('Installation queue'),
    '#content' => installer_browser_get_install_list($variables['type']),
  );
  $variables['install_list'] = render($install_list);

  // Add the advanced options block.
  $advanced_content = backdrop_get_form('installer_browser_manual_install_link');
  $variables['advanced'] = backdrop_render($advanced_content);
}