Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
315
Merge Requests
315
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
57178612
Commit
57178612
authored
May 24, 2013
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1843754
by joelpittet, shanethehat: Convert views/templates/views-view-list.tpl.php to twig.
parent
68803482
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
33 deletions
+58
-33
core/modules/views/templates/views-view-list.html.twig
core/modules/views/templates/views-view-list.html.twig
+44
-0
core/modules/views/templates/views-view-list.tpl.php
core/modules/views/templates/views-view-list.tpl.php
+0
-21
core/modules/views/views.theme.inc
core/modules/views/views.theme.inc
+14
-12
No files found.
core/modules/views/templates/views-view-list.html.twig
0 → 100644
View file @
57178612
{#
/**
* @file
* Default theme implementation for a view template to display a list of rows.
*
* Available variables:
* - rows: A list of rows for this list.
* - row_classes: The row's HTML attributes correlating with the row's 'id'.
* - title: The title of this group of rows. May be empty.
* - list: @todo.
* - type: Starting tag will be either a ul or ol.
* - attributes: HTML attributes for the list element.
*
* @see template_preprocess()
* @see template_preprocess_views_view_list()
*
* @ingroup themeable
*/
#}
{%
if
wrapper_attributes
-
%}
<div
{{
wrapper_attributes
}}
>
{%
endif
%}
{%
if
title
%}
<h3>
{{
title
}}
</h3>
{%
endif
%}
{%
if
list.type
==
'ul'
%}
<ul
{{
list.attributes
}}
>
{%
else
%}
<ol
{{
list.attributes
}}
>
{%
endif
%}
{%
for
id
,
row
in
rows
%}
<li
{{
row_classes
[
id
]
}}
>
{{
row
}}
</li>
{%
endfor
%}
{%
if
list.type
==
'ul'
%}
</ul>
{%
else
%}
</ol>
{%
endif
%}
{%
if
wrapper_attributes
-
%}
</div>
{%
endif
%}
core/modules/views/templates/views-view-list.tpl.php
deleted
100644 → 0
View file @
68803482
<?php
/**
* @file
* Default simple view template to display a list of rows.
*
* - $title : The title of this group of rows. May be empty.
* - $options['type'] will either be ul or ol.
* @ingroup views_templates
*/
?>
<?php
print
$wrapper_prefix
;
?>
<?php
if
(
!
empty
(
$title
))
:
?>
<h3>
<?php
print
$title
;
?>
</h3>
<?php
endif
;
?>
<?php
print
$list_type_prefix
;
?>
<?php
foreach
(
$rows
as
$id
=>
$row
)
:
?>
<li
<?php
print
$row_classes
[
$id
];
?>
>
<?php
print
$row
;
?>
</li>
<?php
endforeach
;
?>
<?php
print
$list_type_suffix
;
?>
<?php
print
$wrapper_suffix
;
?>
core/modules/views/views.theme.inc
View file @
57178612
...
...
@@ -829,10 +829,16 @@ function template_preprocess_views_view_unformatted(&$vars) {
}
/**
* Display the view as an HTML list element
* Prepares variables for Views HTML list templates.
*
* Default template: views-view-list.html.twig.
*
* @param array $variables
* An associative array containing:
* - view: A View object.
*/
function
template_preprocess_views_view_list
(
&
$vars
)
{
$handler
=
$vars
[
'view'
]
->
style_plugin
;
function
template_preprocess_views_view_list
(
&
$var
iable
s
)
{
$handler
=
$var
iable
s
[
'view'
]
->
style_plugin
;
// Fetch classes from handler options.
$class
=
explode
(
' '
,
$handler
->
options
[
'class'
]);
...
...
@@ -842,20 +848,16 @@ function template_preprocess_views_view_list(&$vars) {
$wrapper_class
=
explode
(
' '
,
$handler
->
options
[
'wrapper_class'
]);
$wrapper_class
=
array_map
(
'drupal_clean_css_identifier'
,
$wrapper_class
);
// Initialize a new attribute class for $class.
$attributes
=
new
Attribute
(
array
(
'class'
=>
$class
));
// Initialize a new attribute class for $wrapper_class.
if
(
$wrapper_class
)
{
$wrapper_class
=
new
Attribute
(
array
(
'class'
=>
$wrapper_class
));
$vars
[
'wrapper_prefix'
]
=
'<div'
.
$wrapper_class
.
'>'
;
$vars
[
'wrapper_suffix'
]
=
'</div>'
;
$variables
[
'wrapper_attributes'
]
=
new
Attribute
(
array
(
'class'
=>
$wrapper_class
));
}
$vars
[
'list_type_prefix'
]
=
'<'
.
$handler
->
options
[
'type'
]
.
$attributes
.
'>'
;
$vars
[
'list_type_suffix'
]
=
'</'
.
$handler
->
options
[
'type'
]
.
'>'
;
// Initialize a new attribute class for $class.
$variables
[
'list'
][
'attributes'
]
=
new
Attribute
(
array
(
'class'
=>
$class
));
$variables
[
'list'
][
'type'
]
=
$handler
->
options
[
'type'
];
template_preprocess_views_view_unformatted
(
$vars
);
template_preprocess_views_view_unformatted
(
$var
iable
s
);
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment