Add translatable config_simple_example [#1615520] | Drupal.org
Skip to search
Can we use first and third party cookies and web beacons to
understand our audience, and to tailor promotions you see
Add translatable config_simple_example
Closed (fixed)
Project:
Examples for Developers
Version:
4.0.x-dev
Component:
New modules
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Configuration system
DrupalMumbaiCodeSprint
Reporter:
alberto56
Created:
4 Jun 2012 at 03:29 UTC
Updated:
2 Sep 2024 at 21:34 UTC
Jump to comment:
Most recent
Most recent file
Problem/Motivation
An example which shows how to build a simple translatable configuration form is needed.
Proposed resolution
Add a new example submodule that shows a working translatable configuration form.
Remaining tasks
Review the MR
Original report by alberto56
The newly committed
Configuration system
uses xml files to store configuration rather than global variables, impacting the use of variable_set(), variable_get(), and form submission.
The blog post linked above explains how a module would use this new system. The examples module would be a great place a working example of this.
Cheers,
Albert.
Comment
File
Size
Author
#34
interdiff_31_34.txt
2.94 KB
rcodina
#34
config-simple-example-module-1615520-34.patch
6.76 KB
rcodina
#31
config-simple-example-module-1615520-31.patch
5.34 KB
alexandre.todorov
#21
1615520-21-config-module.patch
26.48 KB
alberto56
#15
1615520-15-config-module.patch
24.71 KB
alberto56
#13
1615520-13-D8-config-module.patch
19.44 KB
alberto56
#4
1615520-4-block_example-with-config-mgmt-d8.zip
9.98 KB
alberto56
#4
1615520-4-update-block-module-for-d8-with-config-mgmt.patch
17.13 KB
alberto56
Issue fork
examples-1615520
Show commands
Start within a Git clone of the project using the
version control instructions
Add & fetch this issue fork’s repository
Or,
if you do not have
SSH keys set up on git.drupalcode.org
Add & fetch this issue fork’s repository
1615520-add-translatable-configsimpleexample
plain diff
MR
!83
Check out this branch for the first time
Check out existing branch, if you already have it locally
About issue forks
Comments
Comment
#1
rfay
he,him
Palisade, CO, USA
commented
10 June 2012 at 21:56
Version:
» 8.x-1.x-dev
Issue tags:
Configuration system
This will be welcome when there's a patch, especially if the person maintaining the patch is willing to make sure it works all the way through the 8.x cycle.
or
to post comments
Comment
#2
alberto56
commented
10 June 2012 at 22:16
Hi,
thanks for the response.
I'm wondering if you purposefully removed the "Configuration system" tag -- It serves to group issues related to the config management initiaive, across projects.
See some examples here
I believe tagging the issue with "Configuration system" might help people looking for issues related to that initiative, even issues not in core; so you might consider replacing that tag on this issue.
Cheers,
Albert.
or
to post comments
Comment
#3
rfay
he,him
Palisade, CO, USA
commented
10 June 2012 at 22:43
Issue tags:
Configuration system
I did deliberately remove it, but I was wrong :-) Most of the time when tags like this show up they're because somebody just thought they should make up some tags :-)
Restoring; Thanks for your work on the config system, and hope to get a good demo module in there. It will need tests, and will need ongoing maintenance as 8.x changes.
or
to post comments
Comment
#4
alberto56
commented
11 June 2012 at 14:12
Title:
Example module for the new Drupal 8 configuration system
» Example module for the new Drupal 8 configuration system: example_block
Status:
Active
» Needs review
Status
File
Size
new
1615520-4-update-block-module-for-d8-with-config-mgmt.patch
17.13 KB
new
1615520-4-block_example-with-config-mgmt-d8.zip
9.98 KB
Hi all,
Instead of creating a whole new module for this, I decided to use a module that was already in the examples suite for D7, the reason being that I needed to test the upgrade path as well.
So here is a patch that does the following:
- upgrades block_example to use D8's new configuration management system
- defines passing automated tests
- defines an upgrade path from D7 version of block_example, which I tested manually (no automated tests for this yet).
Here is the block_module in two versions: (1) as a patch against 8.x branch of examples. (2) as a stand-alone zip file you can add to your D8 installation.
Cheers,
Albert.
or
to post comments
Comment
#5
11 June 2012 at 14:15
Status:
Needs review
» Needs work
The last submitted patch,
1615520-4-update-block-module-for-d8-with-config-mgmt.patch
, failed testing.
or
to post comments
Comment
#6
alberto56
commented
11 June 2012 at 14:25
Hmmm, testbot seems to be trying to be breaking, but on my site, the tests _do_ pass.
By the way, I'll be willing provide ongoing maintenance for this as 8.x changes.
or
to post comments
Comment
#7
rfay
he,him
Palisade, CO, USA
commented
11 June 2012 at 14:52
Thanks for your willingness to do this.
Please do create a new module: configuration_example.module?
Each module is intended to teach exactly one thing. If you need to base it on block_example you can, but its name should tell what you're trying to teach. Please choose the simplest "scaffolding" you can. Block might be OK, but if you can think of something simpler that's great.
The idea is that somebody can look at it and not have to learn *anything* except the config part.
or
to post comments
Comment
#8
rfay
he,him
Palisade, CO, USA
commented
11 June 2012 at 14:56
@alberto56, there's an FAQ about why tests pass locally but not on the testbot at
or
to post comments
Comment
#9
alberto56
commented
11 June 2012 at 14:57
Thanks @rfay,
Would you agree to a new configuration_example module, but still keeping the block_example module as it is in the patch? A couple of notes:
- first, I need an existing module to test/demonstrate the upgrade path.
- Block example, even though it is not meant to demonstrate config management, will still need to use it, because all modes which previously used variable_get() and variable_set() will need to switch to config management.
- I would not make a lot of sense to add an upgrade hook in a new configuration_example module, so instead I can provide a comment in the configuration_example.install file to the hook presently in block_example in this patch.
Does that make sense to you?
Thanks!
Albert.
or
to post comments
Comment
#10
rfay
he,him
Palisade, CO, USA
commented
11 June 2012 at 15:10
I'd really like to have you focus on configuration and not confuse things with links between different example modules. The dbtng_example attempted these things for D7, but did it only with comments. If you don't think it can be done with comments... Do you think it would be reasonable to add a Configuration Example to D7 first, demonstrating all the traditional techniques (db tables, cache, info file, whatever)? Then the D8 version could build on that?
It's OK to use the "block" idea as the core, if you can't get any simpler than that. (Simpletest Examples uses a fork of Nodeapi_example). They key is simplicity.
Just rip out anything not related to what you're trying to teach. Rip out everything that's not essential for teaching or functionality.
or
to post comments
Comment
#11
alberto56
commented
11 June 2012 at 15:20
Do you think it would be reasonable to add a Configuration Example to D7 first
Great idea, that makes a lot of sense, thanks.
or
to post comments
Comment
#12
alberto56
commented
12 June 2012 at 11:20
Title:
Example module for the new Drupal 8 configuration system: example_block
» Example module for the new Drupal 8 configuration system: new module needed
or
to post comments
Comment
#13
alberto56
commented
12 June 2012 at 21:20
Status:
Needs work
» Needs review
Status
File
Size
new
1615520-13-D8-config-module.patch
19.44 KB
- I have created a config module for D7, see
#1630762: Configuration example for D7, so that the upgrade path to D8 may be demonstrated.
- See the enclosed patch for the same module upgraded to D8 using the config system.
- My previous patch, slightly modified, I have submitted in a new issue, because it still works well to demo blocks in D8:
#1630760: Update block example module for D8
Please note that the upgrade path has not been tested yet at all and I'm almost sure it does not work for the more complex configuration (this is in the comments). Let me suggest committing this module as is, and opening a new issue, assigned to me, for the upgrade path.
or
to post comments
Comment
#14
mrsinguyen
commented
28 June 2012 at 08:54
When i delete the one row config on configuration complex then delete all value in configuration.
Message at
No product are defined.
or
to post comments
Comment
#15
alberto56
commented
19 July 2012 at 22:28
Status:
Needs work
» Needs review
Issue tags:
Configuration system
Status
File
Size
new
1615520-15-config-module.patch
24.71 KB
Hi,
Here is a new patch which integrates all the same improvements as the latest patch (comment #8) of
#1630762: Configuration example for D7, so that the upgrade path to D8 may be demonstrated.
Some notes:
(1) @mrsinguyen thanks for pointing out the bug in your comment #14, above. I am confirming that deleting one item was deleting them all, and have added a test to make sure this does not happen. The reason this was happening is that I was using
config::delete()
instead of
config::clear()
to unset the data, so it was deleting everything. It now should work.
(2) I have included a working automated test for the upgrade path.
All tests pass.
Cheers,
Albert.
or
to post comments
Comment
#16
19 July 2012 at 22:28
The last submitted patch,
1615520-15-config-module.patch
, failed testing.
or
to post comments
Comment
#17
alberto56
commented
19 July 2012 at 22:30
Issue tags:
Configuration system
#15
1615520-15-config-module.patch
queued for re-testing.
or
to post comments
Comment
#18
19 July 2012 at 22:32
Status:
Needs review
» Needs work
Issue tags:
Configuration system
The last submitted patch,
1615520-15-config-module.patch
, failed testing.
or
to post comments
Comment
#19
alberto56
commented
20 July 2012 at 21:45
Hmmm, the testbot does not like the fact that the patch contains a .gz file: "error: cannot apply binary patch to 'configuration_example/tests/drupal-7.configuration_example.database.php.gz' without full index line". I'm not sure why. Still, in my tests, everything works.
or
to post comments
Comment
#20
rfay
he,him
Palisade, CO, USA
commented
20 July 2012 at 21:51
It's just failing on the git apply. Are you able to do the git apply against this binary manually? I guess I'm surprised that this is required. Applying patches to binary files is not the strong suit of any tool like this.
or
to post comments
Comment
#21
alberto56
commented
22 July 2012 at 11:53
Status:
Needs work
» Needs review
Status
File
Size
new
1615520-21-config-module.patch
26.48 KB
My fault, I was not creating the patch correctly. I am now using
this technique
. Here is the updated patch.
or
to post comments
Comment
#22
alberto56
commented
25 July 2012 at 00:51
A good chunk of the code is dedicated to implementing and testing an upgrade path from 7.x. Does it make sense to have this here? Or should this be moved to a new module? I have opened an issue about this at
#1699440: A dedicated to module to demonstrate hook_update_N() and automatically testing upgrades and updates
Cheers,
Albert.
or
to post comments
Comment
#23
alberto56
commented
31 July 2012 at 17:40
Status:
Needs review
» Active
As a follow-up to the above comment, I have updated
#1699440: A dedicated to module to demonstrate hook_update_N() and automatically testing upgrades and updates
and
#1630762: Configuration example for D7, so that the upgrade path to D8 may be demonstrated.
Basically, I would suggest removing all upgrade path code from this patch.
or
to post comments
Comment
#24
mile23
Seattle, WA
commented
27 October 2012 at 22:48
So is it a hard-wired need to have a .gz file? It might be better to just have the .php file which can then be comprehended by a human in a diff.
Also, I like the idea that you can make a configuration in D7, do an upgrade to D8, and then test the result. In fact, this might be more of a test_data_integrity_example than a configuration_example, which I think is great.
drupal_set_message(t('Successfully updated the simple configuration variables'));
$config->save();
Is there a way to check if the config is saved before telling the user it happened?
Also, is anyone working on a D7 module to spit out config YAML files?
or
to post comments
Comment
#25
mile23
Seattle, WA
commented
8 December 2012 at 00:39
Status:
Active
» Postponed
Marking as postponed for now:
#1861598: Examples for Drupal 8 needs relatively stable feature set
Please continue development and discussion as desired.
or
to post comments
Comment
#26
mile23
Seattle, WA
commented
25 May 2013 at 18:12
Status:
Postponed
» Needs review
Setting this to 'needs review' to see if it still works. :-)
or
to post comments
Comment
#27
mile23
Seattle, WA
commented
25 May 2013 at 18:12
Issue tags:
Configuration system
#21
1615520-21-config-module.patch
queued for re-testing.
or
to post comments
Comment
#28
25 May 2013 at 18:15
Status:
Needs review
» Needs work
The last submitted patch,
1615520-21-config-module.patch
, failed testing.
or
to post comments
Comment
#29
mile23
Seattle, WA
commented
16 March 2014 at 03:37
Assigned:
alberto56
» Unassigned
Issue summary:
View changes
Feel free to assign yourself back if you're still working on it.
or
to post comments
Comment
#30
mile23
Seattle, WA
commented
2 July 2017 at 18:28
Title:
Example module for the new Drupal 8 configuration system: new module needed
» Add simple_config_example
We currently have the config_entity_example. That example demonstrates entities which are more like the taxonomy use-case.
We currently do not have an example for 'simple' config.
I think we should narrow scope here so we have an example which talks about various elements of 'simple' configuration, such as what goes in the config/ directory, what config/install does, how to get at those values, etc. We'll call it simple_config_example
The patch in #21 is old enough that it sets up config entities using hooks, so it might be more work than it's worth to update the whole thing. Though obviously it could be a starting point.
or
to post comments
Comment
#31
alexandre.todorov
commented
15 September 2017 at 11:20
Status
File
Size
new
config-simple-example-module-1615520-31.patch
5.34 KB
The configuration example module seems to be a little bit old. I have had to present
D8 configuration feedback
at
Meetup Drupal Montpellier
and for that purpose I have created a module for config simple example following the documentation at drupal.org (
Working with Configuration Forms
Defining and using your own configuration
Translating configuration
). Here is the patch.
Enable a second language to test the config translation. There will be a translation tab on the config form
or
to post comments
Comment
#32
mile23
Seattle, WA
commented
22 November 2017 at 00:44
Title:
Add simple_config_example
» Add config_simple_example
Thanks, @alexandre.todorov this looks really good. Just some extra stuff we need to make it a proper Examples project module:
Needs a .module file where we @defgroup config_simple_example.
Needs tests which exercise all the paths.
Needs a test to verify that changing the config through the form changes its value.
+++ b/config_simple_example/config/schema/config_simple_example.schema.yml
@@ -0,0 +1,7 @@
+ type: config_object
Explain config_object and talk about the other types a little bit.
+++ b/config_simple_example/config/schema/config_simple_example.schema.yml
@@ -0,0 +1,7 @@
+ mapping:
Explain what a mapping is.
+++ b/config_simple_example/config_simple_example.config_translation.yml
@@ -0,0 +1,5 @@
+config_simple_example.settings:
Explain how this enables translation. Also, let's make a non-translatable config that is somehow excluded here.
+++ b/config_simple_example/config_simple_example.links.menu.yml
@@ -0,0 +1,12 @@
+config_simple_example.configuration:
...
+config_simple_example.settings:
These aren't showing in the Tools menu.
+++ b/config_simple_example/config_simple_example.links.task.yml
--- /dev/null
+++ b/config_simple_example/config_simple_example.routing.yml
Needs another route to a description page explaining what the user is looking at, with links to the admin pages. Use DescriptionTemplateTrait.
or
to post comments
Comment
#33
ashishdalvi
Mumbai
commented
8 December 2017 at 18:22
Issue tags:
DrupalMumbaiCodeSprint
Marking this issue for Drupal Mumbai Code Sprint
or
to post comments
Comment
#34
rcodina
Catalan
Barcelona
commented
3 February 2024 at 16:06
Title:
Add config_simple_example
» Add translatable config_simple_example
Status
File
Size
new
config-simple-example-module-1615520-34.patch
6.76 KB
new
interdiff_31_34.txt
2.94 KB
I replaced old
core
property with
core_version_requirement
. I also addressed some of the feedback on #32.
or
to post comments
Comment
#35
rcodina
Catalan
Barcelona
commented
3 February 2024 at 16:12
Version:
8.x-1.x-dev
» 4.0.x-dev
or
to post comments
Comment
#36
15 August 2024 at 12:23
rcodina
opened
merge request !83
or
to post comments
Comment
#37
rcodina
Catalan
Barcelona
commented
15 August 2024 at 16:11
Issue summary:
View changes
Status:
Needs work
» Needs review
All feedback from #32 is addressed. The MR has been created from patch on comment #34.
or
to post comments
Comment
#38
rcodina
Catalan
Barcelona
commented
15 August 2024 at 16:12
Issue summary:
View changes
or
to post comments
Comment
#39
15 August 2024 at 16:49
avpaderno
made their first commit to this issue’s fork.
or
to post comments
Comment
#40
avpaderno
he/him
Italian
Brescia, 🇮🇹 🇪🇺
commented
15 August 2024 at 18:13
I tried enabling PHPUnit tests, but GitLab CI does not find any test to run, not even the ones added in this MR.
or
to post comments
Comment
#41
avpaderno
he/him
Italian
Brescia, 🇮🇹 🇪🇺
commented
15 August 2024 at 19:05
Status:
Needs review
» Needs work
or
to post comments
Comment
#42
avpaderno
he/him
Italian
Brescia, 🇮🇹 🇪🇺
commented
15 August 2024 at 19:07
Component:
Other
» New modules
or
to post comments
Comment
#43
rcodina
Catalan
Barcelona
commented
19 August 2024 at 16:27
Status:
Needs work
» Needs review
or
to post comments
Comment
#44
avpaderno
he/him
Italian
Brescia, 🇮🇹 🇪🇺
commented
19 August 2024 at 21:22
I still have to understand why GitLab CI does not find any test implemented by this project.
Since that is not an issue only with the module added in this issue, I will merge the MR provided here.
or
to post comments
Comment
#45
avpaderno
he/him
Italian
Brescia, 🇮🇹 🇪🇺
commented
19 August 2024 at 21:23
5 files were hidden/shown/deleted
Status
File
Size
hidden
1615520-15-config-module.patch
24.71 KB
hidden
1615520-21-config-module.patch
26.48 KB
hidden
config-simple-example-module-1615520-31.patch
5.34 KB
hidden
config-simple-example-module-1615520-34.patch
6.76 KB
hidden
interdiff_31_34.txt
2.94 KB
or
to post comments
Comment
#46
19 August 2024 at 21:28
avpaderno
committed
60f287c0
on
4.0.x
authored by
rcodina
Issue #1615520: Add translatable config_simple_example
or
to post comments
Comment
#47
avpaderno
he/him
Italian
Brescia, 🇮🇹 🇪🇺
commented
19 August 2024 at 21:30
Status:
Needs review
» Fixed
Thank you for providing the merge request! It has been now merged.
or
to post comments
Comment
#48
2 September 2024 at 21:34
Status:
Fixed
» Closed (fixed)
Automatically closed - issue fixed for 2 weeks with no activity.
or
to post comments
Contribution record
Add child issue
clone issue
Referenced by
#2371859: Add Configuration Form example
Infrastructure management for Drupal.org provided by
Need a Drupal 7 extended support partner? Consider Tag1.
News items
News
Planet Drupal
Social media
Sign up for Drupal news
Security advisories
Jobs
Our community
Community
Services
Training
Hosting
Contributor guide
Groups & meetups
DrupalCon
Code of conduct
Documentation
Documentation
Drupal Guide
Drupal User Guide
Developer docs
API.Drupal.org
Drupal code base
Download & Extend
Drupal core
Modules
Themes
Distributions
Governance of community
About
Web accessibility
Drupal Association
About Drupal.org
Drupal is a
registered trademark
of
Dries Buytaert