Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Sub-issue for meta issue #1880976: [meta] Port examples (including submodules) to D9.4+
Problem/Motivation
D8 all the things!
Proposed resolution
Start with D7 version and figure out how to port ;)
Comment | File | Size | Author |
---|---|---|---|
#15 | cache_example_details-2102645-8225505.patch | 392 bytes | sdelbosc |
#7 | 2102645-cache_example-d8-port-7.patch | 15.12 KB | Lukas von Blarer |
#2 | 2102645-cache_example-d8-port.patch | 20.69 KB | Lukas von Blarer |
Comments
Comment #1
Lukas von BlarerWorking on this...
Comment #2
Lukas von BlarerI created a first port. Please review it carefully since this is my first D8 module :)
We are still missing some methods of the new cache API. But the basic functionality is there.
Comment #3
Mile23Thanks, Lukas.
Just a few things thus far...
Just 'Examples'.
Wrong indent on the comments.
NetBeans warns me that UserSession isn't used in this file.
Since this is a documentation project, we want to avoid {@inheritdoc}. Something like: "We're overriding this method because..."
I guess this is coming later...
Comment #4
Mile23Comment #5
Berdir2. The main problem here is actually that it still references cache_get().
4. @inheritdoc is the core standard. This is a cache example module, we don't really need to explain here how a form works? It's not overriding some default logic, it's implementing the method that each form has to, there's nothing special about it's form handling.
5. That might be the only special thing (re form handling) it has. It doesn't have a main save/submit button, just a few specific ones that have their own method. But FormInterface mandates that each form class must have a submitForm() method. That said, we should add a comment inside it why it's empty.
Comment #6
Mile23@Berdir: If you're a newbie you don't already know that buildForm is unrelated to dealing with caches. It's the same problem as submitForm.
Comment #7
Lukas von BlarerI did the requested changes except for the {@inheritdoc} request. It does not improve the example of the cache API but the form API. This should be done inside the form_example module, not in the cache_example module.
Further I removed the old page callback and also removed the unneccessary information inside cache_example_menu(). I also added @todos for the missing examples in the cache API. Lets do this in a separate issue.
Comment #8
Lukas von BlarerComment #10
Mile237: 2102645-cache_example-d8-port-7.patch queued for re-testing.
Comment #11
Mile23Committed: http://drupalcode.org/project/examples.git/commitdiff/7a3635d2631202df5e...
Thanks!
Comment #12
BerdirShould this be set to fixed then? :)
Comment #13
Mile23Indeed it should. :-)
Comment #14
sdelbosc CreditAttribution: sdelbosc commentedOn /admin/modules page this module does not appear in the same group as the other examples.
Comment #15
sdelbosc CreditAttribution: sdelbosc commentedComment #16
tsphethean CreditAttribution: tsphethean commentedLooks good to me!
Comment #17
Mile23Nice catch, thanks.
Committed: http://drupalcode.org/project/examples.git/commitdiff/71035101ff0700d9b5...