The Drupal 8 site I'm building contains some custom forms and pages. On those pages, bits information are inserted that must remain editable by the site editors. In D7, I would probably have used the Variables module for this. There are a couple of options, but none of these seems the ideal solution.

Possible solutions:

  • Use the State API.
    Pro: Does not revert on a config-import.
    Con: Not really meant for this kind of data.
  • Use the Config API.
    Pro: Easy to deploy initial values.
    Con: Needs something like Config Ignore to protect the data from being reverted on a config-import.
  • Create a node type for this kind of information.
    Pro: Provides a well-known admin UI be default.
    Con: Lots of overhead for storing a simple value. No native machine name to reference the value.

Question: How should I store snippets of editor-configurable information, so that it can be retrieved by a machine name, and will not be reverted when a developer does a config import?

  • 1
    Sounds like configuration to me, as you mentioned, there are various ways to exclude certain configuration from being overwritten, drupal.org/project/config_split might be worth looking into. Usually, my workflow simply involves exporting from prod, then merging the new config in, then deploy and import that. – Berdir Apr 7 '17 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.