Skip to main content
17 events
when toggle format what by license comment
Jun 21, 2022 at 8:45 answer added avpaderno timeline score: 0
Oct 25, 2019 at 18:00 history tweeted twitter.com/StackDrupal/status/1187791085680168960
Oct 10, 2018 at 3:05 review Close votes
Oct 11, 2018 at 3:05
Sep 28, 2018 at 14:22 history edited Kwadz CC BY-SA 4.0
corrected spelling
Sep 27, 2018 at 13:16 review Suggested edits
Sep 27, 2018 at 14:53
Sep 27, 2018 at 10:01 answer added leymannx timeline score: 12
Sep 27, 2018 at 9:55 answer added ssibal timeline score: 0
Sep 27, 2018 at 9:28 comment added Clive @Kwadz I would agree - while the concept you're talking about (SoC) is a very generic one, Drupal does have specific things in it that you should use to solve this. Specifically, create a service class, put the functionality in there, and consume it in the thinnest way possible in your hook. Then you can test the service class separately, and your hook is just a dumb proxy for the information it receives (which is arguably what you want)
Sep 27, 2018 at 9:20 history edited Kwadz CC BY-SA 4.0
Added details in the body
Sep 27, 2018 at 9:13 answer added Kwadz timeline score: 2
Sep 27, 2018 at 8:55 history edited Kwadz CC BY-SA 4.0
Added detail in the title
Sep 27, 2018 at 8:54 comment added Kwadz Since Drupal hook system force us to use a .module file, I thought this question would be relevant here to help Drupal users who wants to improve their code for hooks. The idea is to split big methods from this file in more readable and reusable smaller methods. May be I should have named it helper methods. Anyway, if there is some good practices to handle that, I even think that could be added in the doc for hooks.
Sep 26, 2018 at 16:08 comment added Kevin This isn’t a Drupal question really.
Sep 26, 2018 at 15:50 history edited Pierre.Vriens CC BY-SA 4.0
added 3 characters in body
Sep 26, 2018 at 15:25 review Close votes
Sep 26, 2018 at 15:50
Sep 26, 2018 at 15:05 comment added mradcliffe Create a class with a public method, instantiate it in your procedural code, and then have that public method call a private method?
Sep 26, 2018 at 14:32 history asked Kwadz CC BY-SA 4.0