Deploying big release branches, steps to take (dry run merge and checkup)

If you have big sprint with big amount of task and put all of that into feature branch that you need to deploy (merge to master) then it is good to have one big final checkup before doing that. So what I do is this, go to your master branch and either make one temp branch from it like "master_temp" or do it directly there. For extra caution I use temp branch.

Use file_scan_directory and sort files in array

If you are using file_scan_directory to scan files in some directory and then loop over them to use them for some action, you probably also want to sort them, otherwise you will get them in order that is set in filesystem. So to do that, you need to set key in options to "filename" to use filename as key, so you can sort that associative array per key.

Migrations in Drupal 8, what is it all about

Migrations and migration api came as surprise to me, really powerful stuff. It can be used as a tool for one of import of whatever content you might have or for continuous import of some data from any endpoint. With core import module, for proper framework I would suggest adding migrate tools and migrate plus modules. 

Get translated value of particular taxonomy term

First get current language

$language =  \Drupal::languageManager()->getCurrentLanguage(\Drupal\Core\Language\LanguageInterface::TYPE_CONTENT)->getId();

then load term with providing term id

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);