Drupal Dump

Drupal Snippets, Hacks and more....

Orphaned migration config breaks migration UI

If you created some migration config and then you renamed it later, there is a good chance it is still present in config and it can also break your migration UI for that migration group. To clear that out, check your config with drush cedit find id of config and run this in devel/php or drush php

Fetch your mysql configuration

You want to check some environment variables values for your current setup. Log into mysql and type something like

What to use, text list or taxonomy term?

To force users or administrators to have predefined list of what to put into some field you will need to use one of this 2 solutions, text list or taxonomy term reference field. 

Cannot save files in PHPStorm

Maybe you came to that annoying message when you want to save something in PHP Storm but it refuses to and gives you options "cancel" or "revert changes", usually happens around some config files, like settings.php. Why is this so? Probably because you didn't put write permissions to folder where phpstorm is trying to write its temp files.

Get values from $settings variable

When you set or override some variables in settings.php with $settings var and want to get it in your code, call it like this.


use Drupal\Core\Site\Settings;

$mySetting = Settings::get('some_setting', NULL);


Testing drupal site as authenticated user

In order to generate authenticated requests using curl we can use the session cookie from a session in our browser. How to find that? Sign in to your site in your browser. Then find the cookie that starts with either SESS, or SSESS followed by a random string.

Drupal 8 commerce (2.x) - multi currency how to

For multi-currency in drupal 7 commerce we had it all running out of the box with drupal multicurrency modul. You had price fields per currency and rules that would solve that. There is no out of the box solution like that yet, but this module is pretty close to it.