At the moment views_preprocess_node doesn't check for the right row plugin so the function is never called.

If you just replace this with $row_plugin->getPluginId() == 'node' you have to add views_module_include() at the top of the function as well.

Comments

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new12.6 KB

Here is a first start which tests all of RowPlugin, but sadly some parts of the test still fail.

Status: Needs review » Needs work

The last submitted patch, views-1793696-1.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new13.55 KB
new12.98 KB

Fixed all the tests, and rerolled and cleaned a bit up.

tim.plunkett’s picture

So, what's going to happen when we move node.views.inc? And why is that necessary at all?

dawehner’s picture

We could merge this code into one function and put it into node.module, i know this is not optimal.

The reason why this is done is primarily to hide comments/links but not have the need to load this code on every request.

damiankloip’s picture

Status: Needs review » Reviewed & tested by the community

As far as fixing what we have and adding tests, I would say this is good to go. Maybe there is a better way, I'm not sure atm.

I'm told a generic entity row plugin is on the way to solve all our problems :)

dawehner’s picture

Project: Views (for Drupal 7) » Drupal core
Version: 8.x-3.x-dev » 8.x-dev
Component: Code » views.module
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new11.11 KB

Rerole against core.

dawehner’s picture

Issue tags: -Needs tests, -VDC

#7: core-1793696-7.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, core-1793696-7.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
Issue tags: +Needs tests, +VDC
StatusFileSize
new11.17 KB

This patch already has tests. Rerolled against current 8.x and dramatically simplied it by using $this->drupalSetContent().

damiankloip’s picture

#11: drupal-1793696-11.patch queued for re-testing.

damiankloip’s picture

Here are a couple of MINOR nitpicks, apart from that, if this passes, or needs a reroll, this is rtbc.

+++ b/core/modules/views/lib/Drupal/views/Tests/Node/RowPluginTest.phpundefined
@@ -0,0 +1,197 @@
+    // Tests with comments enabled.

This is the only one that is Tests, just use Test..

+++ b/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.phpundefined
@@ -154,6 +155,55 @@ protected function helperCompareFunction($a, $b) {
+   * Performs an xpath search on a certain content.

Lose the 'a'.

Status: Needs review » Needs work

The last submitted patch, drupal-1793696-11.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new9.52 KB

Rerolled.

dawehner’s picture

StatusFileSize
new9.52 KB

Fixes the "tests".

Status: Needs review » Needs work

The last submitted patch, drupal-1793696-16.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new8.61 KB

Rerolled after the comment entity NG patch etc.

dawehner’s picture

#18: drupal-1793696-18.patch queued for re-testing.

dawehner’s picture

StatusFileSize
new8.62 KB
new794 bytes

Nothing important in that rerole.

These are one of these bugs which would be normal in the context of drupal, but major in the context of views, as it is fixing functionality used by like 50% of the people.

Status: Needs review » Needs work
Issue tags: -VDC

The last submitted patch, drupal-1793696-20.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review

#20: drupal-1793696-20.patch queued for re-testing.

dawehner’s picture

Issue tags: +VDC

#20: drupal-1793696-20.patch queued for re-testing.

olli’s picture

Patch #20 solves the problem.

+++ b/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php
@@ -7,6 +7,7 @@
+use DOMDocument;

Is this needed?

+++ b/core/modules/views/views.module
@@ -250,7 +251,7 @@ function views_preprocess_node(&$vars) {
     node_row_node_view_preprocess_node($vars);

Would it be possible (in a follow up) to move this node row preprocessing to noderow::render?

dawehner’s picture

StatusFileSize
new8.23 KB
new252 bytes

Thanks for the review! Fixed the DomDocument stuff, which has been part of some previous patches.

Would it be possible (in a follow up) to move this node row preprocessing to noderow::render?

Interesting idea, as this would improve auto-loading, but I'm not sure we do put preprocess logic into classes at this point. It seems to be that this would be really different to all other parts of core. If we do this, then we should do this in a follow up.

dawehner’s picture

Issue tags: -VDC

#25: drupal-1793696-25.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +VDC

The last submitted patch, drupal-1793696-25.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new1.72 KB
new8.17 KB

Fixed it.

damiankloip’s picture

Patch is looking good, just one question:

+++ b/core/modules/views/views.moduleundefined
@@ -235,6 +235,7 @@ function views_plugin_list() {
 function views_preprocess_node(&$vars) {

Shouldn't maybe node.module be providing this now? Doing this in views.module feels slightly dirty. Now that we're in core, stuff like this could move into node?

dawehner’s picture

Shouldn't maybe node.module be providing this now? Doing this in views.module feels slightly dirty. Now that we're in core, stuff like this could move into node?

Yeah I totally agree, though should this really be done in this issue, as I wanted to let this patch be as small as possible.

damiankloip’s picture

Status: Needs review » Reviewed & tested by the community

Well, now this fix is good, We can easily move this in a follow up for sure. Let's do that.

xjm’s picture

Issue tags: -VDC

#28: drupal-1793696-28.patch queued for re-testing.

Status: Reviewed & tested by the community » Needs work
Issue tags: +VDC

The last submitted patch, drupal-1793696-28.patch, failed testing.

damiankloip’s picture

Status: Needs work » Needs review
StatusFileSize
new3.73 KB
new8.05 KB
dawehner’s picture

StatusFileSize
new612 bytes
new8.14 KB
dawehner’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #34 is perfect!

Status: Reviewed & tested by the community » Needs work
Issue tags: -VDC

The last submitted patch, drupal-1793696-34.patch, failed testing.

damiankloip’s picture

Status: Needs work » Needs review
Issue tags: +VDC

#34: 1793696-34.patch queued for re-testing.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

#34 is green

no_commit_credit’s picture

StatusFileSize
new8.05 KB
new7.06 KB

Exposing the test coverage, and making it clear which is the correct patch.

xjm’s picture

Issue tags: +Quick fix
xjm’s picture

#40: 1793696-34.patch queued for re-testing.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 509cb25 and pushed to 8.x. Thanks!

xjm’s picture

Title: views_preprocess_node check for the wrong row_plugin » HEAD BROKEN: views_preprocess_node check for the wrong row_plugin
Priority: Normal » Critical
Status: Fixed » Reviewed & tested by the community

The test in this patch is currently failing in HEAD.

git revert 509cb25

tim.plunkett’s picture

StatusFileSize
new2.8 KB

Or just use this. It was because of #1938380: Let ViewExecutable->preview() return a render array.
I tested this manually.

webchick’s picture

Title: HEAD BROKEN: views_preprocess_node check for the wrong row_plugin » views_preprocess_node check for the wrong row_plugin
Priority: Critical » Normal
Status: Reviewed & tested by the community » Needs work

All RIGHT, that makes alexpott a REAL core committer now! :D

Reverted commit 509cb25. Restoring various metadata.

webchick’s picture

Status: Needs work » Needs review

Oops.

Status: Needs review » Needs work

The last submitted patch, vdc-1793696-45.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
StatusFileSize
new8.28 KB

Okay, here's both of those.

jibran’s picture

+++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_row_plugin.ymlundefined
@@ -0,0 +1,56 @@
+human_name: test_node_row_plugin

It should be label I think.

dawehner’s picture

StatusFileSize
new1.24 KB
new8.29 KB

You are totally right.

Should we also fix this include, which is added in this patch?

jibran’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Yay! I'm a real core committer now :)

Committed 587ceeb and pushed to 8.x. Thanks!

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