diff --git a/core/modules/views/templates/views-view-field.tpl.php b/core/modules/views/templates/views-view-field.tpl.php deleted file mode 100644 index 91d92ee..0000000 --- a/core/modules/views/templates/views-view-field.tpl.php +++ /dev/null @@ -1,25 +0,0 @@ -{$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. - */ -?> - diff --git a/core/modules/views/views-view-field.html.twig b/core/modules/views/views-view-field.html.twig new file mode 100644 index 0000000..b575c32 --- /dev/null +++ b/core/modules/views/views-view-field.html.twig @@ -0,0 +1,27 @@ +{# +/** + * @file + * Default theme implementation for a single field in a view. + * + * 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 + */ +#} +{% spaceless %} + {{ output }} +{% endspaceless %} diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc index 4178bac..bb33875 100644 --- a/core/modules/views/views.theme.inc +++ b/core/modules/views/views.theme.inc @@ -333,14 +333,19 @@ function theme_views_view_field($vars) { } /** - * Process a single field within a view. - * - * This preprocess function isn't normally run, as a function is used by - * default, for performance. However, by creating a template, this - * preprocess should get picked up. + * Prepares variables for views field templates. + * + * Default template: views-view-field.html.twig. + * + * @param array $variables + * 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) { - $vars['output'] = $vars['field']->advanced_render($vars['row']); +function template_preprocess_views_view_field(&$variables) { + $variables['output'] = $variables['field']->advanced_render($variables['row']); } /**