I have a module that requires some settings per content type. The module is to also provide one admin page where all the settings can be applied across content types at once.
Essentially I'm trying to share configuration information between a custom Admin Settings form and the node type edit form. I had this all working with Drupal 8 Beta 10 or something like that, but I'm trying to get it working with the latest stable release (8.0.4).
I originally used the method described here for my custom Admin form using the following code:
$config = $this->config('mymodule.settings'); '#default_value' => $config->get('my_setting'),
Similarly, for the node edit form alter function, I used:
$config = \Drupal::config('mymodule.settings'); '#default_value' => $config->get('my_setting'),
But the above stopped working for the node type settings form at some point, so I started looking at using Third Party Settings:
$node_type = $form_state->getFormObject()->getEntity(); '#default_value' => $node_type->getThirdPartySetting('mymodule', 'setting', 'default_value'),
This works great for the node type edit form, but I don't know of a way to pull the third-party settings into my custom Admin form partially because getEntity() method isn't available.
So my question is, what is the best practice for sharing configuration settings between a custom admin form and the content type edit form?