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.

Files: 
CommentFileSizeAuthor
#21 1615520-21-config-module.patch26.48 KBalberto56
FAILED: [[SimpleTest]]: [MySQL] Failed to run tests: PHP Fatal error encountered during run_tests.sh. See review log for details..
[ View ]
#15 1615520-15-config-module.patch24.71 KBalberto56
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1615520-15-config-module.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#13 1615520-13-D8-config-module.patch19.44 KBalberto56
PASSED: [[SimpleTest]]: [MySQL] 35 pass(es).
[ View ]
#4 1615520-4-block_example-with-config-mgmt-d8.zip9.98 KBalberto56
#4 1615520-4-update-block-module-for-d8-with-config-mgmt.patch17.13 KBalberto56
FAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.
[ View ]

Comments

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.

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.

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.

Title:Example module for the new Drupal 8 configuration systemExample module for the new Drupal 8 configuration system: example_block
Status:Active» Needs review
StatusFileSize
new17.13 KB
FAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.
[ View ]
new9.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.

Status:Needs review» Needs work

The last submitted patch, 1615520-4-update-block-module-for-d8-with-config-mgmt.patch, failed testing.

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.

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.

@alberto56, there's an FAQ about why tests pass locally but not on the testbot at http://drupal.org/project/testbot.

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.

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.

Do you think it would be reasonable to add a Configuration Example to D7 first

Great idea, that makes a lot of sense, thanks.

Title:Example module for the new Drupal 8 configuration system: example_blockExample module for the new Drupal 8 configuration system: new module needed

Status:Needs work» Needs review
StatusFileSize
new19.44 KB
PASSED: [[SimpleTest]]: [MySQL] 35 pass(es).
[ View ]

- 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.

When i delete the one row config on configuration complex then delete all value in configuration.

Message at http://example.com/dev/drupal-8.x/examples/configuration-complex

No product are defined.

Status:Needs work» Needs review
Issue tags:+Configuration system
StatusFileSize
new24.71 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1615520-15-config-module.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

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.

The last submitted patch, 1615520-15-config-module.patch, failed testing.

Issue tags:-Configuration system

#15: 1615520-15-config-module.patch queued for re-testing.

Status:Needs review» Needs work
Issue tags:+Configuration system

The last submitted patch, 1615520-15-config-module.patch, failed testing.

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.

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.

Status:Needs work» Needs review
StatusFileSize
new26.48 KB
FAILED: [[SimpleTest]]: [MySQL] Failed to run tests: PHP Fatal error encountered during run_tests.sh. See review log for details..
[ View ]

My fault, I was not creating the patch correctly. I am now using this technique. Here is the updated patch.

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.

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.

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?

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.

Status:Postponed» Needs review

Setting this to 'needs review' to see if it still works. :-)

Issue tags:-Configuration system

#21: 1615520-21-config-module.patch queued for re-testing.

Status:Needs review» Needs work

The last submitted patch, 1615520-21-config-module.patch, failed testing.

Assigned:alberto56» Unassigned
Issue summary:View changes

Feel free to assign yourself back if you're still working on it.