Commit e7d739a6 authored by alexpott's avatar alexpott

Issue #1843764 by joelpittet, Cottser, dmouse, shanethehat, jwilson3: Convert...

Issue #1843764 by joelpittet, Cottser, dmouse, shanethehat, jwilson3: Convert views/templates/views-view-summary-unformatted.tpl.php to twig.
parent ed042be0
{#
/**
* @file
* Default theme implementation for unformatted summary links.
*
* Available variables:
* - rows: The rows contained in this view.
* - url: The URL to this row's content.
* - count: The number of items this summary item represents.
* - separator: A separator between each row.
* - row_classes: HTML attributes for a row, either containing an 'active' class
* or no attributes, that correlate to each row by ID.
* - options: Flags indicating how each row should be displayed. This contains:
* - count: A flag indicating whether the row's 'count' should be displayed.
* - inline: A flag indicating whether the item should be wrapped in an inline
* or block level HTML element.
*
* @see template_preprocess()
* @see template_preprocess_views_view_summary_unformatted()
*
* @ingroup themeable
*/
#}
{% for id, row in rows %}
{{ options.inline ? '<span' : '<div' }} class="views-summary views-summary-unformatted">
{% if row.separator -%}
{{ row.separator }}
{%- endif %}
<a href="{{ row.url }}"{{ row_classes[id] }}>{{ row.link }}</a>
{% if options.count %}
({{ row.count }})
{% endif %}
{{ options.inline ? '</span>' : '</div>' }}
{% endfor %}
<?php
/**
* @file
* Default simple view template to display a group of summary lines.
*
* This wraps items in a span if set to inline, or a div if not.
*
* @ingroup views_templates
*/
?>
<?php foreach ($rows as $id => $row): ?>
<?php print (!empty($options['inline']) ? '<span' : '<div') . ' class="views-summary views-summary-unformatted">'; ?>
<?php if (!empty($row->separator)): ?><? print $row->separator; ?><?php endif; ?>
<a href="<?php print $row->url; ?>"<?php print $row_classes[$id]; ?>><?php print $row->link; ?></a>
<?php if (!empty($options['count'])): ?>
(<?php print $row->count; ?>)
<?php endif; ?>
<?php print !empty($options['inline']) ? '</span>' : '</div>'; ?>
<?php endforeach; ?>
......@@ -396,8 +396,17 @@ function template_preprocess_views_view_summary(&$vars) {
}
/**
* Template preprocess theme function to print summary basically
* unformatted.
* Prepares variables for unformatted summary view templates.
*
* Default template: views-view-summary-unformatted.html.twig.
*
* @param array $vars
* An associative array containing:
* - view: A ViewExecutable object.
* - rows: The raw row data.
* - options: An array of options. Each option contains:
* - separator: A string to be placed between inline fields to keep them
* visually distinct.
*/
function template_preprocess_views_view_summary_unformatted(&$vars) {
$view = $vars['view'];
......@@ -412,12 +421,15 @@ function template_preprocess_views_view_summary_unformatted(&$vars) {
$count = 0;
$active_urls = drupal_map_assoc(array(
url(current_path(), array('alias' => TRUE)), // force system path
url(current_path()), // could be an alias
// Force system path.
url(current_path(), array('alias' => TRUE)),
// Could be an alias.
url(current_path()),
));
// Collect all arguments foreach row, to be able to alter them for example by the validator.
// This is not done per single argument value, because this could cause performance problems.
// Collect all arguments for each row, to be able to alter them for example
// by the validator. This is not done per single argument value, because
// this could cause performance problems.
$row_args = array();
foreach ($vars['rows'] as $id => $row) {
$row_args[$id] = $argument->summary_argument($row);
......@@ -425,7 +437,7 @@ function template_preprocess_views_view_summary_unformatted(&$vars) {
$argument->process_summary_arguments($row_args);
foreach ($vars['rows'] as $id => $row) {
// only false on first time:
// Only false on first time.
if ($count++) {
$vars['rows'][$id]->separator = filter_xss_admin($vars['options']['separator']);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment