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()->getEditable('modulename.settings')
->set('checkboxsetting_' . $node_type, $form_state->getValues()['checkboxsettings'])
->set('radiosettings' . $node_type, $form_state->getValues()['radiosettings'])
->save();
and to get the saved values you need to :
\Drupal::config('modulename.settings')->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