Issue #1843746 by joelpittet, trrroy, shanethehat, tlattimore, damiankloip, jastraat, dawehner, thedavidmeister, Cottser, Kevin Morse: Convert views/templates/views-view-field.tpl.php to Twig .
parent
e7d739a6ea
commit
c68896f9c7
|
@ -0,0 +1,28 @@
|
||||||
|
{#
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Default theme implementation for a single field in a view.
|
||||||
|
*
|
||||||
|
* It is not actually used in default views, as this is registered as a theme
|
||||||
|
* function which has better performance. For single overrides, the template is
|
||||||
|
* perfectly okay.
|
||||||
|
*
|
||||||
|
* Available variables:
|
||||||
|
* - view: The view that the field belongs to.
|
||||||
|
* - field: The field handler that can process the input.
|
||||||
|
* - row: The raw result of the database query that generated this field.
|
||||||
|
* - output: The processed output that will normally be used.
|
||||||
|
*
|
||||||
|
* When fetching output from the row this construct should be used:
|
||||||
|
* data = row[field.field_alias]
|
||||||
|
*
|
||||||
|
* The above will guarantee that you'll always get the correct data, regardless
|
||||||
|
* of any changes in the aliasing that might happen if the view is modified.
|
||||||
|
*
|
||||||
|
* @see template_preprocess()
|
||||||
|
* @see template_preprocess_views_view_field()
|
||||||
|
*
|
||||||
|
* @ingroup themeable
|
||||||
|
*/
|
||||||
|
#}
|
||||||
|
{{ output }}
|
|
@ -1,25 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file
|
|
||||||
* This template is used to print a single field in a view.
|
|
||||||
*
|
|
||||||
* It is not actually used in default Views, as this is registered as a theme
|
|
||||||
* function which has better performance. For single overrides, the template is
|
|
||||||
* perfectly okay.
|
|
||||||
*
|
|
||||||
* Variables available:
|
|
||||||
* - $view: The view object
|
|
||||||
* - $field: The field handler object that can process the input
|
|
||||||
* - $row: The raw SQL result that can be used
|
|
||||||
* - $output: The processed output that will normally be used.
|
|
||||||
*
|
|
||||||
* When fetching output from the $row, this construct should be used:
|
|
||||||
* $data = $row->{$field->field_alias}
|
|
||||||
*
|
|
||||||
* The above will guarantee that you'll always get the correct data,
|
|
||||||
* regardless of any changes in the aliasing that might happen if
|
|
||||||
* the view is modified.
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
<?php print $output; ?>
|
|
|
@ -328,11 +328,16 @@ function theme_views_view_field($vars) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process a single field within a view.
|
* Prepares variables for views field templates.
|
||||||
*
|
*
|
||||||
* This preprocess function isn't normally run, as a function is used by
|
* Default template: views-view-field.html.twig.
|
||||||
* default, for performance. However, by creating a template, this
|
*
|
||||||
* preprocess should get picked up.
|
* @param array $vars
|
||||||
|
* An associative array containing:
|
||||||
|
* - field: The field handler object for the current field.
|
||||||
|
* - row: Object representing the raw result of the SQL query for the current
|
||||||
|
* field.
|
||||||
|
* - view: Instance of the ViewExecutable object for the parent view.
|
||||||
*/
|
*/
|
||||||
function template_preprocess_views_view_field(&$vars) {
|
function template_preprocess_views_view_field(&$vars) {
|
||||||
$vars['output'] = $vars['field']->advanced_render($vars['row']);
|
$vars['output'] = $vars['field']->advanced_render($vars['row']);
|
||||||
|
|
Loading…
Reference in New Issue