commit e3e79899b0562a7ab6b524c124a45307c73f4498 Author: Joel Pittet Date: Mon Apr 15 19:44:21 2013 -0700 added docs and fix the exception diff --git a/core/modules/update/templates/update-last-check.html.twig b/core/modules/update/templates/update-last-check.html.twig index 86ed1ff..daaded6 100644 --- a/core/modules/update/templates/update-last-check.html.twig +++ b/core/modules/update/templates/update-last-check.html.twig @@ -4,7 +4,9 @@ * Default theme implementation for the last time we checked for update data. * * Available variables: - * - last: The timestamp when the site last checked for available updates. + * - last_checked: A boolean when the site last checked for available updates. + * - time: The time the site last checked for updates. + * - link: A link to check for updates manually. * * @see template_preprocess() * @see template_preprocess_update_last_check() diff --git a/core/modules/update/templates/update-report.html.twig b/core/modules/update/templates/update-report.html.twig index 6705856..39da3a9 100644 --- a/core/modules/update/templates/update-report.html.twig +++ b/core/modules/update/templates/update-report.html.twig @@ -4,8 +4,25 @@ * Default theme implementation for the project status report. * * Available variables: - * - project_types: @todo. - * - project_type.projects: Data about each project's status. + * - project_types: A list of product types. + * - label: Project type label. + * - projects: Data about each project's status. + * - title: The project tile. + * - attributes: HTML attributes for the product row. + * - status_label: The project status label. + * - reason: @todo. + * - icon: The project status version indicator icon. + * - existing_version: @todo. + * - versions: @todo. + * - install_type: @todo. + * - datestamp: @todo. + * - extra: @todo. + * - attributes: HTML attributes for the extra items. + * - label: @todo. + * - data: @todo. + * - includes: @todo. + * - base_themes: @todo. + * - sub_themes: @todo. * * @see template_preprocess() * @see template_preprocess_update_report() @@ -24,58 +41,76 @@ @see http://drupal.org/node/1867090 #} {% set project_title = project.title %} - + {% set project_attributes = project.attributes %} + {% set project_status_label = project.status_label %} + {% set project_reason = project.reason %} + {% set project_icon = project.icon %} + {% set project_existing_version = project.existing_version %} + {% set project_versions = project.versions %} + {% set project_install_type = project.install_type %} + {% set project_datestamp = project.datestamp %} + {% set project_extra = project.extra %} + {% set project_includes = project.includes %} + {% set project_base_themes = project.base_themes %} + {% set project_sub_themes = project.sub_themes %} + + + {% spaceless %}
- {% if project.status_label is not empty %} - {{ project.status_label }} - {% else %} - {{ project.reason }} - {% endif %} - {{ project.icon }} + {{ project_status_label|default(project_reason) }} + {{ project_icon }}
+ {% endspaceless %} -
- {{ project_title }} {{ project.existing_version }} - {% if project.install_type == 'dev' and project.datestamp %} - ({{ project.datestamp }}) +
{{ project_title }} {{ project_existing_version }} + {% if project.install_type == 'dev' and project_datestamp %} + ({{ project_datestamp }}) {% endif %}
- {% if project.versions %} + + {% if project_versions %}
- {% for version in project.versions %} + {% for version in project_versions %} {{ version }} {% endfor %}
{% endif %} +
- {% if project.extra %} + {% if project_extra %}
- {% for extra in project.extra %} - - {{ extra.label }}: {{ extra.data }} + {% for extra in project_extra %} + {# + 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 extra_attributes = extra.attributes %} + {% set extra_label = extra.label %} + {% set extra_data = extra.data %} + + {{ extra_label }}: {{ extra_data }}
{% endfor %}
{% endif %}
- {{ 'Includes'|t }}: - {{ project.includes }} + {{ project_includes }}
- {% if project.base_themes %} + {% if project_base_themes %}
- {{ 'Depends on: !basethemes'|t({'!basethemes': project.base_themes|join(', ')}) }} + {{ 'Depends on: !basethemes'|t({'!basethemes': project_base_themes|join(', ')}) }}
{% endif %} - {% if project.sub_themes %} + {% if project_sub_themes %}
- {{ 'Required by: %subthemes'|t({'%subthemes': project.sub_themes|join(', ')}) }} + {{ 'Required by: %subthemes'|t({'%subthemes': project_sub_themes|join(', ')}) }}
{% endif %}
- {% endfor %} diff --git a/core/modules/update/templates/update-status-label.html.twig b/core/modules/update/templates/update-status-label.html.twig index 2f036b1..43c8512 100644 --- a/core/modules/update/templates/update-status-label.html.twig +++ b/core/modules/update/templates/update-status-label.html.twig @@ -6,8 +6,7 @@ * Available variables: * - text: The status label text. * - attributes: Remaining HTML attributes for the element. - * - attributes.class: HTML classes that can be used to style contextually - * through CSS. + * - class: HTML classes that can be used to style contextually through CSS. * * @see template_preprocess() * @see template_preprocess_update_status_label() @@ -15,6 +14,8 @@ * @ingroup themeable */ #} -{% if text %} - {{ text|t }} -{% endif %} +{% spaceless %} + {% if text %} + {{ text|t }} + {% endif %} +{% endspaceless %} diff --git a/core/modules/update/templates/update-version.html.twig b/core/modules/update/templates/update-version.html.twig index 457db2c..119a781 100644 --- a/core/modules/update/templates/update-version.html.twig +++ b/core/modules/update/templates/update-version.html.twig @@ -4,16 +4,14 @@ * Default theme implementation for the version display of a project. * * Available variables: - * - version: An array of data about the latest released version, containing: - * - version: The version number. - * - release_link: The URL for the release notes. - * - date: The date of the release. - * - download_link: The URL for the downloadable file. + * - attributes: HTML attributes for the update versions table. + * - version_link: @todo. + * - version_date: The date of the release. + * - version_links: @todo. * - tag: The title of the project. - * - class: A string containing extra classes for the wrapping table. * - * @see template_preprocess - * @see template_preprocess_update_version + * @see template_preprocess() + * @see template_preprocess_update_version() * * @ingroup themeable */ diff --git a/core/modules/update/update.report.inc b/core/modules/update/update.report.inc index b191fb1..ffbea3e 100644 --- a/core/modules/update/update.report.inc +++ b/core/modules/update/update.report.inc @@ -53,7 +53,7 @@ function update_status() { * - data: An array of data about each project's status. */ function template_preprocess_update_report(&$variables) { - $projects = $variables['data']; + $data = $variables['data']; $rows = array(); $notification_level = config('update.settings')->get('notification.threshold'); @@ -61,13 +61,13 @@ function template_preprocess_update_report(&$variables) { // Create an array of status values keyed by module or theme name, since // we'll need this while generating the report if we have to cross reference // anything (e.g. subthemes which have base themes missing an update). - foreach ($projects as $project) { + foreach ($data as $project) { foreach ($project['includes'] as $key => $name) { $status[$key] = $project['status']; } } - foreach ($projects as $project) { + foreach ($data as $project) { switch ($project['status']) { case UPDATE_CURRENT: $class = 'ok'; @@ -133,6 +133,9 @@ function template_preprocess_update_report(&$variables) { if (!empty($project['reason'])) { $row['reason'] = check_plain($project['reason']); } + else { + $row['reason'] = ''; + } // Set the project title. if (isset($project['title'])) { @@ -264,12 +267,13 @@ function template_preprocess_update_report(&$variables) { $includes_items[] = t('Disabled: %disabled', array('%disabled' => implode(', ', $project['disabled']))); $row['includes'] = array( + '#prefix' => t('Includes:'), '#theme' => 'item_list', '#items' => $includes_items, ); } else { - $row['includes'] = t('%includes', array('%includes' => implode(', ', $project['includes']))); + $row['includes'] = t('Includes: %includes', array('%includes' => implode(', ', $project['includes']))); } if (!empty($project['base_themes'])) { @@ -282,10 +286,7 @@ function template_preprocess_update_report(&$variables) { case UPDATE_NOT_SUPPORTED: $base_themes[] = t('%base_theme (!base_label)', array( '%base_theme' => $base_theme, - '!base_label' => array( - '#theme' => 'update_status_label', - '#status' => $status[$base_key], - ), + '!base_label' => theme('update_status_label', array('status' => $status[$base_key])), )); break;