Using Configuration API in drupal 8 I altered node_type_edit_form and added a section to get some settings like below:



Now I need to save the configurations and build the default value based on last selection using Configuration API .

The problem is it needs to build the fields selected (checkbox) in every content type form.
I believe that you have machine name of content type while altering node_type_edit_form. So I assume that $node_type is the variable in which machine name can be accessible.

So as stated in drupal list changes, variable_get and variable_set is replaced by config system in drupal 8.

To save a configuration you need to add this code in your submit function :

\Drupal::configFactory()-&gt;getEditable('modulename.settings')
    -&gt;set('checkboxsetting_' . $node_type, $form_state-&gt;getValues()['checkboxsettings'])
    -&gt;set('radiosettings' . $node_type, $form_state-&gt;getValues()['radiosettings'])
    -&gt;save();


and to get the saved values you need to :

\Drupal::config('modulename.settings')-&gt;get('checkboxsetting_' . $node_type);


To set the default configuration from yml file. Create a yml file and content will be :

modulename/config/install/modulename.settings.yml

checkboxsetting_page: whatever
checkboxsetting_article: whatever
radio_page: whatever
radio_article: whatever