You are here

function _flippy_node_type_form_submit in Flippy 8

Creating custom form submit handler to save the settings to config file.

1 string reference to '_flippy_node_type_form_submit'
flippy_form_node_type_edit_form_alter in ./flippy.module
Implements hook_form_FORM_ID_alter().

File

./flippy.module, line 324
Allows administrators to add previous/next pagers to any node type.

Code

function _flippy_node_type_form_submit($form, FormStateInterface $form_state) {
  \Drupal::configFactory()
    ->getEditable('flippy.settings')
    ->set('flippy_' . $form['type']['#default_value'], $form_state
    ->getValue('flippy'))
    ->set('flippy_head_' . $form['type']['#default_value'], $form_state
    ->getValue('flippy_head'))
    ->set('flippy_show_empty_' . $form['type']['#default_value'], $form_state
    ->getValue('flippy_show_empty'))
    ->set('flippy_prev_label_' . $form['type']['#default_value'], Html::escape($form_state
    ->getValue('flippy_prev_label')))
    ->set('flippy_next_label_' . $form['type']['#default_value'], Html::escape($form_state
    ->getValue('flippy_next_label')))
    ->set('flippy_first_last_' . $form['type']['#default_value'], $form_state
    ->getValue('flippy_firstlast'))
    ->set('flippy_first_label_' . $form['type']['#default_value'], Html::escape($form_state
    ->getValue('flippy_first_label')))
    ->set('flippy_last_label_' . $form['type']['#default_value'], Html::escape($form_state
    ->getValue('flippy_last_label')))
    ->set('flippy_loop_' . $form['type']['#default_value'], $form_state
    ->getValue('flippy_loop'))
    ->set('flippy_random_' . $form['type']['#default_value'], $form_state
    ->getValue('flippy_random'))
    ->set('flippy_random_label_' . $form['type']['#default_value'], Html::escape($form_state
    ->getValue('flippy_random_label')))
    ->set('flippy_truncate_' . $form['type']['#default_value'], $form_state
    ->getValue('flippy_truncate'))
    ->set('flippy_ellipse_' . $form['type']['#default_value'], $form_state
    ->getValue('flippy_ellipse'))
    ->set('flippy_press_swipe_' . $form['type']['#default_value'], $form_state
    ->getValue('flippy_press_swipe'))
    ->set('flippy_custom_sorting_' . $form['type']['#default_value'], $form_state
    ->getValue('flippy_custom_sorting'))
    ->set('flippy_sort_' . $form['type']['#default_value'], $form_state
    ->getValue('flippy_sort'))
    ->set('flippy_order_' . $form['type']['#default_value'], $form_state
    ->getValue('flippy_order'))
    ->save();
}