commit 8c87af8ad0d186f949e9cd3902088e0f24efc890 Author: Joel Pittet Date: Sat Apr 13 13:34:55 2013 -0700 slightly closer but still far off diff --git a/core/modules/update/templates/update-report.html.twig b/core/modules/update/templates/update-report.html.twig index cf9e711..6705856 100644 --- a/core/modules/update/templates/update-report.html.twig +++ b/core/modules/update/templates/update-report.html.twig @@ -4,40 +4,43 @@ * Default theme implementation for the project status report. * * Available variables: - * - data: An array of data about each project's status. + * - project_types: @todo. + * - project_type.projects: Data about each project's status. * * @see template_preprocess() * @see template_preprocess_update_report() * * @ingroup themeable */ -{{ dump(project_types) }} #} - {% for project_type in project_types %}

{{ project_type.label }}

{% for project in project_type.projects %} - + {# + Use temporary variable for project title. This somehow works + around the issue. Is this a Twig or an Attribute() issue? + @see http://drupal.org/node/1867090 + #} + {% set project_title = project.title %} - {% endfor %}
{% if project.status_label is not empty %} {{ project.status_label }} {% else %} - {{ project.status }} + {{ project.reason }} {% endif %} {{ project.icon }}
- {{ project.title }} {{ project.existing_version }} - {% if project.install_type == 'dev' and project.datestamp is not empty %} + {{ project_title }} {{ project.existing_version }} + {% if project.install_type == 'dev' and project.datestamp %} ({{ project.datestamp }}) {% endif %}
- {% if project.versions %}
{% for version in project.versions %} @@ -45,7 +48,6 @@ {% endfor %}
{% endif %} -
{% if project.extra %}
@@ -56,7 +58,6 @@ {% endfor %}
{% endif %} -
{{ 'Includes'|t }}: {{ project.includes }} @@ -77,7 +78,6 @@
diff --git a/core/modules/update/templates/update-version.html.twig b/core/modules/update/templates/update-version.html.twig index f3aec6a..457db2c 100644 --- a/core/modules/update/templates/update-version.html.twig +++ b/core/modules/update/templates/update-version.html.twig @@ -23,7 +23,7 @@ {{ tag }} {{ version_link }} - {{ version_date }} + ({{ version_date }}) {{ version_links }} diff --git a/core/modules/update/update.report.inc b/core/modules/update/update.report.inc index 74bd377..b191fb1 100644 --- a/core/modules/update/update.report.inc +++ b/core/modules/update/update.report.inc @@ -36,7 +36,6 @@ function update_status() { return $build; } - $build['report'] = array( '#theme' => 'update_report', '#data' => $data, @@ -122,37 +121,37 @@ function template_preprocess_update_report(&$variables) { break; } - $project['icon'] = $icon; - $project['status_label'] = array( + // Used to collect the project values. + $row = array(); + $row['attributes'] = new Attribute(array('class' => $class)); + $row['icon'] = $icon; + $row['status_label'] = array( '#theme' => 'update_status_label', '#status' => $project['status'], ); if (!empty($project['reason'])) { - $project['reason'] = check_plain($project['reason']); + $row['reason'] = check_plain($project['reason']); } - // Store locally for key later. - $project_title = ''; - // Set the project title. if (isset($project['title'])) { - $project_title = $project['title']; if (isset($project['link'])) { - $project['title'] = l($project['title'], $project['link']); + $row['title'] = l($project['title'], $project['link']); } else { - $project['title'] = check_plain($project['title']); + $row['title'] = check_plain($project['title']); } } else { - $project['title'] = check_plain($project['name']); + $row['title'] = check_plain($project['name']); } - $project['existing_version'] = check_plain($project['existing_version']); + // Clean up the version for twig. + $row['existing_version'] = check_plain($project['existing_version']); - if (!empty($project['datestamp'])) { - $project['datestamp'] = format_date($project['datestamp'], 'custom', 'Y-M-d'); + if ($project['install_type'] == 'dev' && !empty($project['datestamp'])) { + $row['datestamp'] = format_date($project['datestamp'], 'custom', 'Y-M-d'); } $versions_inner = array(); @@ -242,31 +241,35 @@ function template_preprocess_update_report(&$variables) { } if (!empty($versions_inner)) { - $project['versions'] = $versions_inner; + $row['versions'] = $versions_inner; } + $row['extra'] = array(); if (!empty($project['extra'])) { - foreach ($project['extra'] as &$extra_item) { - $extra_item['attributes'] = new Attribute(array('class' => $extra_item['class'])); - $extra_item['label'] = check_plain($extra_item['label']); - $extra_item['data'] = drupal_placeholder($extra_item['data']); + foreach ($project['extra'] as $key => $value) { + $extra_item = array(); + $extra_item['attributes'] = new Attribute(array('class' => $value['class'])); + $extra_item['label'] = check_plain($value['label']); + $extra_item['data'] = drupal_placeholder($value['data']); + $row['extra'][$key] = $extra_item; } } sort($project['includes']); if (!empty($project['disabled'])) { sort($project['disabled']); - + // Make sure we start with a clean slate for each project in the report. + $includes_items = array(); $includes_items[] = t('Enabled: %includes', array('%includes' => implode(', ', $project['includes']))); $includes_items[] = t('Disabled: %disabled', array('%disabled' => implode(', ', $project['disabled']))); - $project['includes'] = array( + $row['includes'] = array( '#theme' => 'item_list', '#items' => $includes_items, ); } else { - $project['includes'] = t('%includes', array('%includes' => implode(', ', $project['includes']))); + $row['includes'] = t('%includes', array('%includes' => implode(', ', $project['includes']))); } if (!empty($project['base_themes'])) { @@ -290,21 +293,20 @@ function template_preprocess_update_report(&$variables) { $base_themes[] = drupal_placeholder($base_theme); } } - $project['base_themes'] = $base_themes; + $row['base_themes'] = $base_themes; } if (!empty($project['sub_themes'])) { sort($project['sub_themes']); + $row['sub_themes'] = $project['sub_themes']; } - $project['attributes'] = new Attribute(array('class' => $class)); - // Build project rows. if (!isset($rows[$project['project_type']])) { $rows[$project['project_type']] = array(); } - $row_key = !empty($project_title) ? drupal_strtolower($project_title) : drupal_strtolower($project['name']); - $rows[$project['project_type']][$row_key] = $project; + $row_key = !empty($project['title']) ? drupal_strtolower($project['title']) : drupal_strtolower($project['name']); + $rows[$project['project_type']][$row_key] = $row; } $project_types = array(