109
votes
What does "The provided host name is not valid for this server" mean?
This error message is coming from a feature that was added to Drupal 8 to protect against HTTP Host header attacks. The feature is also described in the change record that was generated for the patch....
Community wiki
96
votes
How can I import the configuration on a different site?
Youu can get the UUID with drush config-get "system.site" uuid.
You can change it with drush config-set "system.site" uuid [uuid].
- 1,095
58
votes
How do I remove a configuration object from the active configuration?
The easiest way to do this at the moment is to use drush php (or core-cli) to open an interactive session.
Then use:
Drupal::configFactory()->getEditable('system.menu.devel')->delete();
This ...
- 751
43
votes
Accepted
How to remove mymodule configurations on uninstall
The easiest way is to ensure that the config has a dependency on your module.
dependencies:
module:
- yourmodule
enforced:
module:
- yourmodule
Then Drupal will automatically ...
- 82.1k
34
votes
How do I remove a configuration object from the active configuration?
Drush command to delete configuration object: drush config-delete <config_name>.
- 5,439
32
votes
Accepted
How do I update the configuration of a module?
As mentioned in the original question, and follow-up comments, there are a variety of contrib modules and manual methods to accomplish this.
To do it automatically, or in a custom fashion, I think ...
- 5,002
31
votes
Import a single yml configuration file
You can use
$ drush cim --partial --source=only-few-configs/
Your help says:
$ drush cim --help
Import config from a config directory.
Examples:
drush config-import --partial Import ...
- 3,581
25
votes
How can I import the configuration on a different site?
The Configuration Management only allow sync configuration between same site or project to avoid issues importing configuration from site a.com to b.com, to accomplish this validation Drupal 8 ...
- 3,581
22
votes
Accepted
Drupal 8 variable_get
In Drupal 7
$data = variable_get('test_content_types');
In Drupal 8
$data = \Drupal::state()->get('test_content_types');
For more information about about "get", "set", "delete" visit - Step ...
- 4,674
20
votes
Import a single yml configuration file
You can import one configuration by running the following command:
drupal config:import:single
If you are trying to run multiple import you can create a chain for that.
Command Documentation - ...
- 4,674
18
votes
How do I update the configuration of a module?
I've found this Gist on GitHub, which reverts/reloads given module's configuration using drush:
drush cim -y --partial --source=modules/path/to/module/config/install/
- 7,216
18
votes
How to prevent Devel module to be installed on production environments
Method: Drush
Drush can ignore the enabled states of extensions when synchronizing configuration.
drush cex --skip-modules=devel
drush cim --skip-modules=devel
With Drush CMI tools you can operate ...
17
votes
Accepted
How can I import the configuration on a different site?
Using Drupal Console
You can override your current site's UUID with the value present in the configuration you want to import.
You can achieve this with Drupal Console by overriding the uuid key for ...
- 547
17
votes
How do I remove a configuration object from the active configuration?
You can use the following methods.
Use the following code in hook_uninstall
Drupal::configFactory()->reset('field.storage.bloom_stem.bs_twitter_ac');
OR
in the yml file you can put the ...
- 2,755
15
votes
How do I fix a "Mismatched entity and/or field definitions" error on my configuration?
drush entity-updates (aka drush entup) has been deprecated as of Drupal 8.7.0. You either need to write an update script using hook_update_N(), or you can use the Devel Entity Updates module, which ...
- 16.1k
14
votes
Accepted
Drupal reuses its hash salt
I have migrated other CMS's to Drupal and had experience moving user accounts. Drupal's password algorithm is extremely good.
The salt you are referring to in the settings.php is not used for ...
- 1,095
14
votes
How can I exclude configuration from import/export?
You can use the "Config Ignore" module: https://www.drupal.org/project/config_ignore
Ever experienced that your site's configuration was overridden by the configuration on the filesystem, ...
- 301
14
votes
How to load field configurations in code
The terminology is a bit confusing (as usual with Drupal), but here goes:
Field storage configurations are defined by FieldStorageConfig. To load one, do this:
$field = Drupal::entityTypeManager()-&...
- 872
14
votes
Accepted
Best Way to Handle Variables Per Environment
You can create a new setting in your settings.local.php or settings.php file like:
$settings['event_base_url'] = 'https://www.example.com';
or some people are adding switch block based on the server ...
- 13.7k
13
votes
Accepted
What are cloned sites in Drupal 8?
Cloned site means that you copied the database instead of installing twice from scratch.
Drupal identifies two different sites as cloned sites by checking their uuid. If the uuids match, then it will ...
- 6,563
13
votes
How do I update the configuration of a module?
As I landed on this question as well but did not really find the correct answer for my situation here, I'd like to add another answer.
Please note: Anti-pattern ahead!
Use case
When we're ...
- 859
13
votes
Accepted
Configuration export/import doesn't work
Configuration management is exporting exactly what it was designed to do: Export the configuration settings. The actual taxonomy terms themselves are sitting in the taxonomy_term_field_data table in ...
- 304
13
votes
Accepted
What order should configuration import and module updates be run?
Updates must be run before configuration is imported
A pending issue against core will ensure that the code and schema versions match before allowing configuration to be imported.
Problems with ...
- 1,544
13
votes
Accepted
How do I fix a "Mismatched entity and/or field definitions" error on my configuration?
You can solve this issue by two ways.
If you installed Drush, you can run drush entity-updates. Otherwise, add the following lines in the index.php file located in the Drupal root folder, before $...
- 332
13
votes
Accepted
YML For Enabling a Contrib Module
To enable a module, you just need a line in core.extension.yml. However, you also need all the configuration the module provides. You could copy that over yourself from the config install and optional ...
- 82.1k
13
votes
Accepted
Attempt to create a field body that does not exist on entity type node
You attempted to create a field using configuration without creating the field storage configuration.
In the field configuration YAML you can see a field_storage property. That is the id of the field ...
- 3,186
13
votes
Accepted
Manage config translations programmatically
The answer from @Smartsheet eng is correct if you want to load and read a specific translation as a config entity, see also How to progragrammatically get NodeType translated value in D8?.
However, ...
- 82.1k
12
votes
What does "The provided host name is not valid for this server" mean?
This happens because trusted_host_patterns variable in your settings file. If you're working on the local environment and you want to override this, define the following section in your settings.local....
Community wiki
12
votes
Accepted
When to use mapping or sequence to define an array in a schema file?
A sequence is an unlimited list of identically structured elements. A mapping is a limited set of keys, each key has a possibly different structure.
Your key has node types, so you're storing a list ...
- 82.1k
12
votes
Accepted
How can I programatically change the (D8 core) workflow state of an entity with Content Moderation?
A great example could be found in Content Moderation module's code.
$entity->set('moderation_state', $new_state);
if ($entity instanceof RevisionLogInterface) {
$entity->setRevisionLogMessage(...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
configuration × 8118 × 397
7 × 92
entities × 49
drush × 49
database × 40
installation × 32
9 × 26
importing-exporting × 26
forms × 25
features × 21
migrations × 21
theming × 20
users × 19
blocks × 19
i18n-l10n × 18
multi-sites × 17
installation-profiles × 16
security × 15
views × 14
hooks × 14
caching × 14
nodes × 13
6 × 12
testing × 12