diff --git a/core/modules/views/src/Tests/Plugin/StyleOpmlTest.php b/core/modules/views/src/Tests/Plugin/StyleOpmlTest.php index 6580c0c..be72ae2 100644 --- a/core/modules/views/src/Tests/Plugin/StyleOpmlTest.php +++ b/core/modules/views/src/Tests/Plugin/StyleOpmlTest.php @@ -56,6 +56,10 @@ public function testOpmlOutput() { ->create($values); $feed->save(); + // Enable the Classy theme. + \Drupal::service('theme_handler')->install(['classy']); + $this->config('system.theme')->set('default', 'classy')->save(); + $this->drupalGet('test-feed-opml-style'); $outline = $this->xpath('//outline[1]'); $this->assertEqual($outline[0]['type'], 'rss', 'The correct type attribute is used for rss OPML.'); diff --git a/core/modules/views/src/Tests/Plugin/StyleTableTest.php b/core/modules/views/src/Tests/Plugin/StyleTableTest.php index ad2c76d..0d6078f 100644 --- a/core/modules/views/src/Tests/Plugin/StyleTableTest.php +++ b/core/modules/views/src/Tests/Plugin/StyleTableTest.php @@ -83,6 +83,10 @@ public function testAccessibilitySettings() { public function testFieldInColumns() { $this->drupalGet('test-table'); + // Enable the Classy theme. + \Drupal::service('theme_handler')->install(['classy']); + $this->config('system.theme')->set('default', 'classy')->save(); + // Ensure that both columns are in separate tds. // Check for class " views-field-job ", because just "views-field-job" won't // do: "views-field-job-1" would also contain "views-field-job". diff --git a/core/modules/views/templates/views-exposed-form.html.twig b/core/modules/views/templates/views-exposed-form.html.twig index f5b5fc3..3fdc576 100644 --- a/core/modules/views/templates/views-exposed-form.html.twig +++ b/core/modules/views/templates/views-exposed-form.html.twig @@ -18,6 +18,6 @@ #} {{ q }} {% endif %} -
+
{{ form }}
diff --git a/core/modules/views/templates/views-mini-pager.html.twig b/core/modules/views/templates/views-mini-pager.html.twig index e17311a..7d9b14a 100644 --- a/core/modules/views/templates/views-mini-pager.html.twig +++ b/core/modules/views/templates/views-mini-pager.html.twig @@ -12,11 +12,11 @@ */ #} {% if items.previous or items.next %} -
{% endfor %} @@ -66,9 +42,9 @@ {% endfor %} {% else %} {% for column in items %} - + {% for row in column.content %} - + {{ row.content }} {% endfor %} diff --git a/core/modules/views/templates/views-view-grouping.html.twig b/core/modules/views/templates/views-view-grouping.html.twig index f06e6b6..2418587 100644 --- a/core/modules/views/templates/views-view-grouping.html.twig +++ b/core/modules/views/templates/views-view-grouping.html.twig @@ -16,7 +16,7 @@ * @ingroup themeable */ #} -
-
{{ title }}
-
{{ content }}
+
+
{{ title }}
+
{{ content }}
diff --git a/core/modules/views/templates/views-view-row-opml.html.twig b/core/modules/views/templates/views-view-row-opml.html.twig index 431dc5c..e6c5d79 100644 --- a/core/modules/views/templates/views-view-row-opml.html.twig +++ b/core/modules/views/templates/views-view-row-opml.html.twig @@ -11,4 +11,4 @@ * @ingroup themeable */ #} - + diff --git a/core/modules/views/templates/views-view-row-rss.html.twig b/core/modules/views/templates/views-view-row-rss.html.twig index e07244c..476bf10 100644 --- a/core/modules/views/templates/views-view-row-rss.html.twig +++ b/core/modules/views/templates/views-view-row-rss.html.twig @@ -14,9 +14,9 @@ * @ingroup themeable */ #} - - {{ title }} - {{ link }} - {{ description }} - {{ item_elements }} - + + {{ title }} + {{ link }} + {{ description }} + {{ item_elements }} + diff --git a/core/modules/views/templates/views-view-summary-unformatted.html.twig b/core/modules/views/templates/views-view-summary-unformatted.html.twig index 57a6e83..63fe111 100644 --- a/core/modules/views/templates/views-view-summary-unformatted.html.twig +++ b/core/modules/views/templates/views-view-summary-unformatted.html.twig @@ -25,7 +25,7 @@ {% if row.separator -%} {{ row.separator }} {%- endif %} - {{ row.link }} + {{ row.link }} {% if options.count %} ({{ row.count }}) {% endif %} diff --git a/core/modules/views/templates/views-view-summary.html.twig b/core/modules/views/templates/views-view-summary.html.twig index f1e788b..ff943ea 100644 --- a/core/modules/views/templates/views-view-summary.html.twig +++ b/core/modules/views/templates/views-view-summary.html.twig @@ -20,10 +20,10 @@ * @ingroup themeable */ #} -
-
    +
    +
      {% for row in rows %} -
    • {{ row.link }} +
    • {{ row.link }} {% if options.count %} ({{ row.count }}) {% endif %} diff --git a/core/modules/views/templates/views-exposed-form.html.twig b/core/themes/classy/templates/views/views-exposed-form.html.twig similarity index 100% copy from core/modules/views/templates/views-exposed-form.html.twig copy to core/themes/classy/templates/views/views-exposed-form.html.twig diff --git a/core/modules/views/templates/views-mini-pager.html.twig b/core/themes/classy/templates/views/views-mini-pager.html.twig similarity index 100% copy from core/modules/views/templates/views-mini-pager.html.twig copy to core/themes/classy/templates/views/views-mini-pager.html.twig diff --git a/core/modules/views/templates/views-more.html.twig b/core/themes/classy/templates/views/views-more.html.twig similarity index 100% copy from core/modules/views/templates/views-more.html.twig copy to core/themes/classy/templates/views/views-more.html.twig diff --git a/core/themes/classy/templates/views/views-view-field.html.twig b/core/themes/classy/templates/views/views-view-field.html.twig new file mode 100644 index 0000000..a058548 --- /dev/null +++ b/core/themes/classy/templates/views/views-view-field.html.twig @@ -0,0 +1,27 @@ +{# +/** + * @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_views_view_field() + * + * @ingroup themeable + */ +#} +{{ output }} diff --git a/core/modules/views/templates/views-view-grid.html.twig b/core/themes/classy/templates/views/views-view-grid.html.twig similarity index 100% copy from core/modules/views/templates/views-view-grid.html.twig copy to core/themes/classy/templates/views/views-view-grid.html.twig diff --git a/core/modules/views/templates/views-view-grouping.html.twig b/core/themes/classy/templates/views/views-view-grouping.html.twig similarity index 100% copy from core/modules/views/templates/views-view-grouping.html.twig copy to core/themes/classy/templates/views/views-view-grouping.html.twig diff --git a/core/themes/classy/templates/views/views-view-list.html.twig b/core/themes/classy/templates/views/views-view-list.html.twig new file mode 100644 index 0000000..8de787c --- /dev/null +++ b/core/themes/classy/templates/views/views-view-list.html.twig @@ -0,0 +1,38 @@ +{# +/** + * @file + * Default theme implementation for a view template to display a list of rows. + * + * Available variables: + * - attributes: HTML attributes for the container. + * - rows: A list of rows for this list. + * - attributes: The row's HTML attributes. + * - content: The row's contents. + * - 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_views_view_list() + * + * @ingroup themeable + */ +#} +{% if attributes -%} + +{% endif %} + {% if title %} +

      {{ title }}

      + {% endif %} + + <{{ list.type }}{{ list.attributes }}> + + {% for row in rows %} + {{ row.content }}
    • + {% endfor %} + + + +{% if attributes -%} +
    +{% endif %} diff --git a/core/themes/classy/templates/views/views-view-opml.html.twig b/core/themes/classy/templates/views/views-view-opml.html.twig new file mode 100644 index 0000000..0564bf6 --- /dev/null +++ b/core/themes/classy/templates/views/views-view-opml.html.twig @@ -0,0 +1,25 @@ +{# +/** + * @file + * Default template for feed displays that use the OPML style. + * + * Available variables: + * - title: The title of the feed (as set in the view). + * - updated: The modified date of the feed. + * - items: The feed items themselves. + * + * @see template_preprocess_views_view_opml() + * + * @ingroup themeable + */ +#} + + + + {{ title }} + {{ updated }} + + + {{ items }} + + diff --git a/core/modules/views/templates/views-view-row-opml.html.twig b/core/themes/classy/templates/views/views-view-row-opml.html.twig similarity index 88% copy from core/modules/views/templates/views-view-row-opml.html.twig copy to core/themes/classy/templates/views/views-view-row-opml.html.twig index 431dc5c..e6c5d79 100644 --- a/core/modules/views/templates/views-view-row-opml.html.twig +++ b/core/themes/classy/templates/views/views-view-row-opml.html.twig @@ -11,4 +11,4 @@ * @ingroup themeable */ #} - + diff --git a/core/modules/views/templates/views-view-row-rss.html.twig b/core/themes/classy/templates/views/views-view-row-rss.html.twig similarity index 70% copy from core/modules/views/templates/views-view-row-rss.html.twig copy to core/themes/classy/templates/views/views-view-row-rss.html.twig index e07244c..476bf10 100644 --- a/core/modules/views/templates/views-view-row-rss.html.twig +++ b/core/themes/classy/templates/views/views-view-row-rss.html.twig @@ -14,9 +14,9 @@ * @ingroup themeable */ #} - - {{ title }} - {{ link }} - {{ description }} - {{ item_elements }} - + + {{ title }} + {{ link }} + {{ description }} + {{ item_elements }} + diff --git a/core/themes/classy/templates/views/views-view-rss.html.twig b/core/themes/classy/templates/views/views-view-rss.html.twig new file mode 100644 index 0000000..19b5097 --- /dev/null +++ b/core/themes/classy/templates/views/views-view-rss.html.twig @@ -0,0 +1,30 @@ +{# +/** + * @file + * Default template for feed displays that use the RSS style. + * + * Available variables: + * - link: The link to the feed (the view path). + * - namespaces: The XML namespaces (added automatically). + * - title: The title of the feed (as set in the view). + * - description: The feed description (from feed settings). + * - langcode: The language encoding. + * - channel_elements: The formatted channel elements. + * - items: The feed items themselves. + * + * @see template_preprocess_views_view_rss() + * + * @ingroup themeable + */ +#} + + + + {{ title }} + {{ link }} + {{ description }} + {{ langcode }} + {{ channel_elements }} + {{ items }} + + diff --git a/core/modules/views/templates/views-view-summary-unformatted.html.twig b/core/themes/classy/templates/views/views-view-summary-unformatted.html.twig similarity index 100% copy from core/modules/views/templates/views-view-summary-unformatted.html.twig copy to core/themes/classy/templates/views/views-view-summary-unformatted.html.twig diff --git a/core/modules/views/templates/views-view-summary.html.twig b/core/themes/classy/templates/views/views-view-summary.html.twig similarity index 100% copy from core/modules/views/templates/views-view-summary.html.twig copy to core/themes/classy/templates/views/views-view-summary.html.twig diff --git a/core/themes/classy/templates/views/views-view-table.html.twig b/core/themes/classy/templates/views/views-view-table.html.twig new file mode 100644 index 0000000..48f8a4f --- /dev/null +++ b/core/themes/classy/templates/views/views-view-table.html.twig @@ -0,0 +1,104 @@ +{# +/** + * @file + * Default theme implementation for displaying a view as a table. + * + * Available variables: + * - attributes: Remaining HTML attributes for the element. + * - class: HTML classes that can be used to style contextually through CSS. + * - title : The title of this group of rows. + * - header: The table header columns. + * - attributes: Remaining HTML attributes for the element. + * - content: HTML classes to apply to each header cell, indexed by + * the header's key. + * - default_classes: A flag indicating whether default classes should be + * used. + * - caption_needed: Is the caption tag needed. + * - caption: The caption for this table. + * - accessibility_description: Extended description for the table details. + * - accessibility_summary: Summary for the table details. + * - rows: Table row items. Rows are keyed by row number. + * - attributes: HTML classes to apply to each row. + * - columns: Row column items. Columns are keyed by column number. + * - attributes: HTML classes to apply to each column. + * - content: The column content. + * - default_classes: A flag indicating whether default classes should be + * used. + * - responsive: A flag indicating whether table is responsive. + * - sticky: A flag indicating whether table header is sticky. + * + * @see template_preprocess_views_view_table() + * + * @ingroup themeable + */ +#} +{% + set classes = [ + 'views-table', + 'views-view-table', + 'cols-' ~ header|length, + responsive ? 'responsive-enabled', + sticky ? 'sticky-enabled', + ] +%} + + {% if caption_needed %} + + {% if caption %} + {{ caption }} + {% else %} + {{ title }} + {% endif %} + {% if (summary is not empty) or (description is not empty) %} +
    + {% if summary is not empty %} + {{ summary }} + {% endif %} + {% if description is not empty %} + {{ description }} + {% endif %} +
    + {% endif %} + + {% endif %} + {% if header %} + + + {% for key, column in header %} + {% if column.default_classes %} + {% + set column_classes = [ + 'views-field', + 'views-field-' ~ fields[key], + ] + %} + {% endif %} + + {{ column.content }} + + {% endfor %} + + + {% endif %} + + {% for row in rows %} + + {% for key, column in row.columns %} + {% if column.default_classes %} + {% + set column_classes = [ + 'views-field' + ] + %} + {% for field in column.fields %} + {% set column_classes = column_classes|merge(['views-field-' ~ field]) %} + {% endfor %} + {% endif %} + + {{ column.content }} + + {% endfor %} + + {% endfor %} + + diff --git a/core/themes/classy/templates/views/views-view-unformatted.html.twig b/core/themes/classy/templates/views/views-view-unformatted.html.twig new file mode 100644 index 0000000..7ee1f81 --- /dev/null +++ b/core/themes/classy/templates/views/views-view-unformatted.html.twig @@ -0,0 +1,32 @@ +{# +/** + * @file + * Default theme implementation to display a view of unformatted rows. + * + * Available variables: + * - title: The title of this group of rows. May be empty. + * - rows: A list of the view's row items. + * - attributes: The row's HTML attributes. + * - content: The row's content. + * - view: The view object. + * - default_row_class: A flag indicating whether default classes should be + * used on rows. + * + * @see template_preprocess_views_view_unformatted() + * + * @ingroup themeable + */ +#} +{% if title %} +

    {{ title }}

    +{% endif %} +{% for row in rows %} + {% + set row_classes = [ + default_row_class ? 'views-row', + ] + %} + + {{ row.content }} +
+{% endfor %} diff --git a/core/themes/classy/templates/views/views-view.html.twig b/core/themes/classy/templates/views/views-view.html.twig new file mode 100644 index 0000000..a62bde1 --- /dev/null +++ b/core/themes/classy/templates/views/views-view.html.twig @@ -0,0 +1,97 @@ +{# +/** + * @file + * Default theme implementation for main view template. + * + * Available variables: + * - attributes: Remaining HTML attributes for the element. + * - css_name: A css-safe version of the view name. + * - css_class: The user-specified classes names, if any. + * - header: The optional header. + * - footer: The optional footer. + * - rows: The results of the view query, if any. + * - empty: The content to display if there are no rows. + * - pager: The optional pager next/prev links to display. + * - exposed: Exposed widget form/info to display. + * - feed_icons: Optional feed icons to display. + * - more: An optional link to the next page of results. + * - title: Title of the view, only used when displaying in the admin preview. + * - title_prefix: Additional output populated by modules, intended to be + * displayed in front of the view title. + * - title_suffix: Additional output populated by modules, intended to be + * displayed after the view title. + * - attachment_before: An optional attachment view to be displayed before the + * view content. + * - attachment_after: An optional attachment view to be displayed after the + * view content. + * - dom_id: Unique id for every view being printed to give unique class for + * Javascript. + * + * @see template_preprocess_views_view() + * + * @ingroup themeable + */ +#} +{% + set classes = [ + 'view', + 'view-' ~ id|clean_class, + 'view-id-' ~ id, + 'view-display-id-' ~ display_id, + dom_id ? 'view-dom-id-' ~ dom_id, + ] +%} + + {{ title_prefix }} + {% if title %} + {{ title }} + {% endif %} + {{ title_suffix }} + {% if header %} +
+ {{ header }} +
+ {% endif %} + {% if exposed %} +
+ {{ exposed }} +
+ {% endif %} + {% if attachment_before %} +
+ {{ attachment_before }} +
+ {% endif %} + + {% if rows %} +
+ {{ rows }} +
+ {% elseif empty %} +
+ {{ empty }} +
+ {% endif %} + + {% if pager %} + {{ pager }} + {% endif %} + {% if attachment_after %} +
+ {{ attachment_after }} +
+ {% endif %} + {% if more %} + {{ more }} + {% endif %} + {% if footer %} + + {% endif %} + {% if feed_icons %} +
+ {{ feed_icons }} +
+ {% endif %} +