Motivation

Configure views no-results behavio. Atm this is just ignored. That can be handled within Vue, but that's not so handy.

Proposed resolution

Let's support at least plain text or html, rendering everything unsupported via drupal-markup.
As follow-up or already here, let's also support the plugins which do entity-rendering by rendering them via custom elements.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

fago created an issue. See original summary.

ciprian.stavovei made their first commit to this issue’s fork.

ciprian.stavovei’s picture

Status: Active » Needs review

Pull request added ready for review. Also added the entity-rendering.

    "slots": {
      "rows": [],
      "empty": [
        {
          "element": "drupal-markup",
          "slots": {
            "default": "\n\u003Carticle class=\"contextual-region node node--type-author-profile node--unpublished node--view-mode-teaser\"\u003E\n\n  \n      \u003Ch2\u003E\n      \u003Ca href=\"/author/william-shakespeare\" rel=\"bookmark\"\u003E\u003Cspan class=\"visually-hidden\"\u003E about William Shakespeare\u003C/span\u003E\u003C/a\u003E\u003C/li\u003E\u003C/ul\u003E  \u003C/div\u003E\n\n  \u003C/div\u003E\n\n\u003C/article\u003E\n"
          }
        }
      ]
    }

Output will look something like this now.
Old output:

 },
    "slots": {
      "rows": []
    }
fago’s picture

Status: Needs review » Needs work

thx. looks pretty good!

Since entity-rendering is working also properly, let's add a test-case for that to show/see that is correctly handling the custom-elements serialization and picking-up the ce-configuration for the entity view modes. Could you extend the test coverage for that ppls?

ciprian.stavovei’s picture

Status: Needs work » Needs review

Done.

fago’s picture

Status: Needs review » Needs work

thx, but you did shortcut the solution. we want things to work without having to force-entity rendering, the View already uses CE-plugins so those should trigger the entity-rendering with the custom-elements-generator automatically (as it is done when you render an entity as part of results). -> it should work without "force".

As noted, let's also include header/footer areas here and add the slots for them when we can use the same codepath? i.e. we probably should have a helper method for handling one area and re-use for header/footer/empty area.

ciprian.stavovei’s picture

Status: Needs work » Needs review

Addressed review feedback
- Extracted buildAreaElements() helper method for shared area processing
- Added header, footer, and empty areas as slots via a unified loop (all three use the same codepath)
- Added header/footer area handlers to the test view config
- Consolidated edge case tests into existing empty-results test methods to avoid extra Drupal bootstraps
- Removed forced CE rendering test — Views CE display plugins handle entity rendering automatically

fago’s picture

Status: Needs review » Needs work

thx, looks great now!

I think there are some small things that need to be taken care of before we can call this done:

* We need to update our default-view component with the new slots, part of nuxtjs-drupal-ce. Please add a PR there to update it.
* Area support header/footer has no test coverage. can we add some simple test covering something there? so it cannot accidenitally break.
* Would be great if you could share some screenshots of working views-output in the frontend, e.g. rendering some node-tease in header/footer?

So setting needs-work for that.

ciprian.stavovei’s picture

Issue summary: View changes
StatusFileSize
new330.97 KB
new86.23 KB

nuxtjs-drupal-ce PR: https://github.com/drunomics/nuxtjs-drupal-ce/pull/443.
Test coverage for header/footer areas:
Already included in the MR — tests cover:
- Header/footer slots in JSON and markup responses (page display)
- Header/footer slots on block custom element + rendered output
- Header/footer correctly absent on empty results (area handlers default to not showing on empty)

Here's a screenshot with a node in the header and media in the footer:
view with header

ciprian.stavovei’s picture

Status: Needs work » Needs review
ciprian.stavovei’s picture

StatusFileSize
new461.73 KB
fago’s picture

Thanks, this seems great!

However, according to
https://api.drupal.org/api/drupal/core%21modules%21views%21templates%21v...
the footer should be below the pager, not above. So this seems to need correction in the vue files. Else this seems good to go.

ciprian.stavovei’s picture

StatusFileSize
new415.51 KB

I updated the nuxtjs-drupal-ce PR: https://github.com/drunomics/nuxtjs-drupal-ce/pull/443.
Also added a new screenshot with the footer under the pager:
View header and footer

fago’s picture

Status: Needs review » Fixed

thx, all good - merged!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.