You are here

function addanother_form_node_type_form_submit in Add Another 8

Custom handler submit for node type form.

1 string reference to 'addanother_form_node_type_form_submit'
addanother_form_node_type_form_alter in ./addanother.module
Implements hook_form_BASE_FORM_form_alter().

File

./addanother.module, line 79
Allows users to Add Another node of the same type easily.

Code

function addanother_form_node_type_form_submit(&$form, FormStateInterface $form_state) {
  $node_type = $form_state
    ->getFormObject()
    ->getEntity();
  $type = $node_type
    ->get('type');
  $config = \Drupal::service('config.factory')
    ->getEditable('addanother.settings');
  $config
    ->set('button.' . $type, $form_state
    ->getValue('button'))
    ->set('message.' . $type, $form_state
    ->getValue('message'))
    ->set('tab.' . $type, $form_state
    ->getValue('tab'))
    ->set('tab_edit.' . $type, $form_state
    ->getValue('tab_edit'))
    ->save();
}