Postponed
Project:
Examples for Developers
Version:
5.0.x-dev
Component:
New modules
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
2 Oct 2013 at 03:51 UTC
Updated:
13 Apr 2026 at 15:21 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jhoelcq commentedAn start version of the port.
Comment #2
mile23Thanks, @jhoelcq. If you set an issue to 'Needs review' the testbot will check your patch.
Comment #3
marvil07 commentedBack to NW.
Comment #4
mile23Looks like a good start, but we need a lot more of the documentation and tests from the D7 version.
Converting the tests to D8 can help provide some structure, even if they fail.
Here's the Examples module checklist you can poke through for some guidance: #2209627: [meta] Module Checklist for Examples
Comment #5
marvil07 commentedComment #6
vijaycs85Here is the working version of the module. it covers what we have in core!.
Comment #7
vijaycs85and a page for demo

Comment #8
mile23The patch applies, but trying to install comes back with this:
Looks like this is the relevant change: https://www.drupal.org/node/2382211
Comment #9
vijaycs85yep, updating to latest HEAD...
Comment #10
mile23Patch applies, and the module can be enabled, but there's no menu on the front page for
examples/toolbar_example. When I visit that path, I get this fatal error:So it at least needs a facelift to stop using
Stringand start usingSafeMarkup.Comment #11
joshi.rohit100Working on this.
Comment #12
joshi.rohit100Here it is.
Comment #13
joshi.rohit100Comment #14
mile23Looking better, just a few things:
Should be 'Contains...' style instead.
Maybe call it TokenExampleTest? :-)
Also, we now have Drupal\examples\Tests\ExamplesTestBase to subclass. You'd use it because we also need a test of whether there's a link in the tool menu.
Nice to have a routing file. Also needs a *.links.menu.yml file as well, so the link appears in the tool menu, with accompanying test.
Comment #15
joshi.rohit100Aye Aye Captain :)
Comment #16
joshi.rohit100Comment #18
joshi.rohit100It seems like if we use ExamplesTestBase as base for our test cases (as per #14), we need to enable block the block module.
Now I don't know if that we should do here in this issue or in separate issue (as current issue is only for token).
Comment #19
joshi.rohit100Comment #20
frobI have queued a retest to see where we are with this 3 year old patch. Does anyone remember what is left on this issue? Looks like only tests holding it up.
Comment #21
mile23Here's the checklist for examples: #2209627: [meta] Module Checklist for Examples
Needs: @defgroup/@ingroup annotation so it shows up at api.drupal.org
In-code documentation explaining what everything is, why you'd need it, what it does. This is especially true in hook_tokens() which is the most complicated part of the code.
Test that the token actually works.
Many occurrences of array() which should be [].
Probably other stuff...
Comment #22
mile23CS improvements.
Added @defgroup, @ingroup.
TokenExampleTest is now WTB.
Added a Kernel test for the tokens themselves.
Still needs:
Comment #23
mile23NW based on #22.
Comment #24
joshi.rohit100Is it fine to use *.module file to token hooks? I mean it will work but I think this should be in *.token.inc
Comment #25
mile23A bit of re-arranging.
Still needs more inline stuff in the @defgroup docblock.
Expand on the twig description stuff.
I'm still not sure what we're demonstrating with 'token_example_type'.
If anyone wants to jump in, please give it a go. :-)
Comment #26
mile23Might help to include the patch.
Comment #27
jungleThe default branch is 3.x-dev now, which is Drupal 9 compatible. And I would port this to Drupal 9. :)
Comment #28
avpadernoComment #29
avpadernoComment #30
avpadernoComment #31
avpaderno