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.
In #1615520: Add translatable config_simple_example we want to create a new example module for the config system, but to truly demonstrate the upgrade path we will need to have a similar module in D7 (suggested by rfay in comment #10 of the above-mentioned issue).
Comment | File | Size | Author |
---|---|---|---|
#8 | 1630762-8-config-module.patch | 24.86 KB | alberto56 |
#5 | 1630762-5-D7-config-module.patch | 20.1 KB | alberto56 |
#3 | 1630762-3-D7-config-module.patch | 20.1 KB | alberto56 |
#1 | 1630762-1-D7-config-module.patch | 47.99 KB | alberto56 |
Comments
Comment #1
alberto56 CreditAttribution: alberto56 commentedHere is a patch
Comment #3
alberto56 CreditAttribution: alberto56 commentedHere is another one.
Comment #5
alberto56 CreditAttribution: alberto56 commentedoops, syntax error
Comment #6
rfay@alberto56, thanks for this! I think you're well on the way.
I wasn't able to understand your intent by just reading the code; the README.txt helped, but the code didn't really explain to me what you were doing.
Could you
1. Simplify the database-based configuration so you can just focus on the fact that it's configuration.
2. Improve the comments to explain that you're using the database table for configuration (and how it changes the behavior of the module)
Please begin the .module file with an explanation of what you're trying to do (the info you put into the README).
Please move the non-hook functions below the hook functions.
When you do the database-based configuration, please explain what it is that is happening.
Again, thanks very much for this, and sorry for the slow review!
Comment #7
alberto56 CreditAttribution: alberto56 commented@rfay thanks for the feedback. I have started work on this, and will provide an updated patch when I return from my vacation mid-July.
Cheers,
Albert.
Comment #8
alberto56 CreditAttribution: alberto56 commentedHi,
Here is a new patch which takes rfay's considerations into account. Here are a few notes:
(1) "Simplify the database-based configuration": I have removed the kitten "size", leaving only the name, machine name, and color. These are all important in my opinion: the machine name is automatically derived from the name -- this is standard throughout the Drupal interface I think; and the color exists so that we can associated two (or more) pieces of data, which is what complex configuration usually does. If anyone has any concrete ideas as to how I can simplify this more, please let me know!
(2) I have added comments everywhere to explain further what I am trying to accomplish. If any passage or code appears unclear, please specify which. Specifically, @rfay if you still would like clarification on database-based configuration, please refer to precise passages.
(3) Function order: Hook functions, then non-hook functions.
(4) Added a new test to confirm that deleting one item does not delete others as well.
(5) All tests pass and have been tested.
(6) These improvements have also been included in a new version (comment #15) of the patch in #1615520: Add translatable config_simple_example
(7) Repaired an issue, and added a test, where deleting a set xyz from the complex configuration caused a erroneous message "xyz does not exist" to appear on-screen.
Cheers,
Albert.
Comment #9
alberto56 CreditAttribution: alberto56 commentedIn light of #1699440: A dedicated to module to demonstrate hook_update_N() and automatically testing upgrades and updates, I suggest setting this issue to "not fixed". This patch's reason for being was only to demonstrate the upgrade path to #1615520: Add translatable config_simple_example, but it seems clunky to me now -- the upgrade path should be demonstrated in a separate example module.
Thoughts?
Comment #10
Mile23I'm closing this as a duplicate of #2182621: Add Migrate example
If there's something else going on here that I'm missing, please re-open this issue. Thanks.