Use the config function instead of configFactory property in forms

Some forms that extend Drupal\Core\Form\FormBase use $this->configFactory directly when trying to access configs. This can result in the configFactory property not being initialized when it's not explicitly set in the constructor, resulting in function calls on null, when trying to access config keys. It seems that this was a mistake introduced with the dependency injection rewrite, and should probably be a call to the configFactory function of the Drupal\Core\Form\FormBase, which makes sure that the configFactory property is initialized before returning it. However, when reading the comment on this function it says:

When accessing configuration values, use $this->config(). Only use this when the config factory needs to be manipulated directly.

So we should use $this->config() in forms that don't access configFactory directly. Forms that inherit from Drupal\Core\Form\ConfigFormBase are not affected, since this class always sets the configFactory property in the constructor...

Merge request reports

Loading