Postponed
Project:
Examples for Developers
Version:
5.0.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
2 Oct 2013 at 03:36 UTC
Updated:
13 Apr 2026 at 15:46 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
javisr commentedi will work on it.
Comment #2
vordude commentedSo. I realize i didn't take the steps outlined in #1880976: [meta] Port examples (including submodules) to D9.4+ but this first patch gives a good start to step 4 (Port example code to D8).
A functional port of the D7 version of the code. Which made a bit more sense to me when realizing that some things would have to be done completely different in the D8 version than the D7 version.
I fiddled for awhile to figure out how to add an additional property to the node the way it was possible with previous versions of drupal adding a form field with hook_form_alter. I wasn't sure that was easily possible, so I added a field to the article content type. This is probably not an acceptable dependency, but it's a start to get a functional version working.
Comment #3
joshi.rohit100Should be $this->t
Also we don't use private in Drupal, so change visibility from private.
Comment #4
vordude commentedComment #5
navneet0693 commentedComment #6
navneet0693 commentedComment #7
navneet0693 commentedAdding tests, entry in example.module, improving code.
Comment #8
navneet0693 commentedComment #11
mile23Included interdiff in patch. How to make a patch: https://www.drupal.org/node/707484
Also whitespace errors and so forth.
Updating issue summary with how to review a patch like this.
Comment #12
navneet0693 commentedHI @Mile23, accidentally included, interdiff in patch. I am recreating the patch.
Comment #13
navneet0693 commentedComment #14
navneet0693 commentedComment #16
Torenware commentedLooks like you have a syntax error:
See if fixing this makes your patch run. This is a simpletest (how can you tell? Because it's in MODULE_NAME/src/Testing). First, try running it on the admin/config/development/testing. Usually, if this works, your patch will run under the testbot. In the rare cases it doesn't, you might also use the run-test.sh tool, but most of the time, you won't really need to. This error should surface easily.
Comment #17
navneet0693 commented@Torenware, thanks for pointing out the error :) working on it.
Comment #18
mile23Generally unassigning issues. Please re-assign yourself as desired.
Comment #19
dpagini commentedAttempting a re-roll of this to apply cleanly and fix the Simpletest error. I wasn't exactly sure what the problem-child line from #16 was doing, so I referenced back to an old test, and updated the code to match that. We'll see how this does. I did not add anything to this, just was looking for an examples module for node_access and stumbled upon this, so thought I'd apply it and see if I could help get it posted.
Comment #20
mile23Thanks, but that patch looks a little incomplete...
Comment #21
dpagini commentedUgh, embarrassed I posted that w/o looking. I guess I haven't posted a patch with a new file(s) in it before, so I had to look up how to do it. Sorry about that, I hope this one is better.
Comment #23
dpagini commentedComment #24
mile23Moved the test to BrowserTestBase, because it's better. :-)
The test now fails instead of having a crash.
I'm not sure what to do about the cronRun() line.
Interdiffs are very helpful, but optional. Still tho... :-) https://www.drupal.org/documentation/git/interdiff
Comment #26
dpagini commentedYeah, attached is as far as I can get... I just don't think this code is working actually. My test is failing when my user goes to the search page, and tries to find private nodes. It's expecting the user can only find the node they published, so 1 search result, but instead the site is returning 3 nodes (all the private nodes) and that's failing the tests. These tests need a lot of work, and I'm sure there will be some work after this cron situation is figured out.
Anyways, I'm trying to get into node_access with a project I'm working on now, so if I learn along the way what's wrong with this code, I'll come back and take a look at it again.
This does not have Mile23's latest additions in it if anyone comes along to work on this.
I'll have to look into how to create and post the interdiff files. Thanks for the link!
Comment #27
navneet0693 commentedChanged the ambiguous code in tests and with few coding standard fixes.
Comment #28
navneet0693 commentedComment #30
mile23My intuition is that
node_access_example_install()isn't an up-to-date way of doing things.We need to have a way to put this in the
config/folder.Comment #31
navneet0693 commentedComment #33
michaellenahan commentedThe patch in #31 needed a reroll.
Comment #34
michaellenahan commentedChanging status to "needs review" to start the test runner.
Comment #36
michaellenahan commentedHmm. I don't know why I get the error:
FATAL Drupal\Tests\node_access_example\Functional\NodeAccessExampleTest: test runner returned a non-zero
https://www.drupal.org/pift-ci-job/918676
... is it because of the coding standards violation, I wonder.
node_access_example/node_access_example.module
line 121 Doc comment short description must be on a single line, further text should be a separate paragraph
... let's see ...
Comment #37
michaellenahan commentedComment #39
michaellenahan commentedSo, it wasn't anything to do with the coding standards violation ... https://www.drupal.org/pift-ci-job/919420 ... I don't know what's causing the error.
Comment #40
avpadernoComment #41
avpadernoComment #42
avpaderno