public function SettingsForm::submitForm in Permissions by Term 8.2
Same name and namespace in other branches
- 8 src/Form/SettingsForm.php \Drupal\permissions_by_term\Form\SettingsForm::submitForm()
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides ConfigFormBase::submitForm
File
- src/
Form/ SettingsForm.php, line 111
Class
Namespace
Drupal\permissions_by_term\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
\Drupal::configFactory()
->getEditable('permissions_by_term.settings')
->set('require_all_terms_granted', $form_state
->getValue('require_all_terms_granted'))
->save();
\Drupal::configFactory()
->getEditable('permissions_by_term.settings')
->set('permission_mode', $form_state
->getValue('permission_mode'))
->save();
if ($form_state
->getValue('disable_node_access_records') && !\Drupal::configFactory()
->getEditable('permissions_by_term.settings')
->get('disable_node_access_records')) {
node_access_rebuild(true);
}
if (!$form_state
->getValue('disable_node_access_records') && \Drupal::configFactory()
->getEditable('permissions_by_term.settings')
->get('disable_node_access_records')) {
node_access_rebuild(true);
}
\Drupal::configFactory()
->getEditable('permissions_by_term.settings')
->set('disable_node_access_records', $form_state
->getValue('disable_node_access_records'))
->save();
$bundles = array_filter($form_state
->getValue('target_bundles'));
$this->configFactory
->getEditable('permissions_by_term.settings')
->set('target_bundles', array_values($bundles))
->save();
parent::submitForm($form, $form_state);
}