You are here

function book_access_admin_settings_submit in Book access 1.x

Submit handler for book_admin_settings form.

Parameters

array $form:

\Drupal\Core\Form\FormStateInterface $form_state:

1 string reference to 'book_access_admin_settings_submit'
book_access_form_alter in ./book_access.module
Implements hook_form_alter().

File

./book_access.module, line 222

Code

function book_access_admin_settings_submit(array $form, FormStateInterface $form_state) {
  if ($form['#id'] == 'book-admin-settings' && $form_state
    ->hasValue('book_access_defaults')) {
    $bookAccessHelper = \Drupal::service('book_access.book_access_helper');
    $bookAccessHelper
      ->updateDefaultsSettings($form_state
      ->getValue('book_access_defaults'));
    \Drupal::messenger()
      ->addMessage(t('Saved book access defaults.'));
  }
}