You are here

public function SystemBrandingOffCanvasForm::submitConfigurationForm in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/src/Form/SystemBrandingOffCanvasForm.php \Drupal\system\Form\SystemBrandingOffCanvasForm::submitConfigurationForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides PluginFormInterface::submitConfigurationForm

File

core/modules/system/src/Form/SystemBrandingOffCanvasForm.php, line 114

Class

SystemBrandingOffCanvasForm
The settings_tray form handler for the SystemBrandingBlock.

Namespace

Drupal\system\Form

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  $site_config = $this->configFactory
    ->get('system.site');
  if (AccessResult::allowedIf(!$site_config
    ->hasOverrides('name') && !$site_config
    ->hasOverrides('slogan'))
    ->isAllowed()) {
    $site_info = $form_state
      ->getValue('site_information');
    $this->configFactory
      ->getEditable('system.site')
      ->set('name', $site_info['site_name'])
      ->set('slogan', $site_info['site_slogan'])
      ->save();
  }
  $this->plugin
    ->submitConfigurationForm($form, $form_state);
}