You are here

function template_preprocess_l10n_update_update_info in Localization update 7.2

Prepares variables for translation status information templates.

Translation status information is displayed per language.

Default template: l10n_update-translation-update-info.tpl.php.

Parameters

array $variables: An associative array containing:

  • updates: The projects which have updates.
  • not_found: The projects which updates are not found.

See also

l10n_update_status_form()

File

./l10n_update.admin.inc, line 479
Admin settings and update page.

Code

function template_preprocess_l10n_update_update_info(array &$variables) {
  $details = array();
  $modules = array();

  // Default values.
  $variables['modules'] = array();
  $variables['module_list'] = '';
  $details['available_updates_list'] = array();

  // Build output for available updates.
  if (isset($variables['updates'])) {
    $releases = array();
    if ($variables['updates']) {
      foreach ($variables['updates'] as $update) {
        $modules[] = $update['name'];
        $releases[] = t('@module (@date)', array(
          '@module' => $update['name'],
          '@date' => format_date($update['timestamp'], 'html_date'),
        ));
      }
      $variables['modules'] = $modules;
      $variables['module_list'] = t('Updates for: @modules', array(
        '@modules' => implode(', ', $modules),
      ));
    }
    $details['available_updates_list'] = array(
      '#theme' => 'item_list',
      '#items' => $releases,
    );
  }

  // Build output for updates not found.
  if (isset($variables['not_found'])) {
    $releases = array();
    $variables['missing_updates_status'] = format_plural(count($variables['not_found']), 'Missing translations for one project', 'Missing translations for @count projects');
    if ($variables['not_found']) {
      foreach ($variables['not_found'] as $update) {
        $version = $update['version'] ? $update['version'] : t('no version');
        $releases[] = t('@module (@version).', array(
          '@module' => $update['name'],
          '@version' => $version,
        )) . ' ' . $update['info'];
      }
    }
    $details['missing_updates_list'] = array(
      '#theme' => 'item_list',
      '#items' => $releases,
    );

    // Prefix the missing updates list if there is an available updates lists
    // before it.
    if (!empty($details['missing_updates_list']['#items'])) {
      $details['missing_updates_list']['#prefix'] = t('Missing translations for:');
    }
  }
  $variables['details'] = $details;
}