You are here

public function JavascriptLibrariesDefaultForm::submitForm in JavaScript Libraries Manager 8

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 FormInterface::submitForm

File

src/Form/JavascriptLibrariesDefaultForm.php, line 93
Contains \Drupal\javascript_libraries\Form\JavascriptLibrariesDefaultForm.

Class

JavascriptLibrariesDefaultForm

Namespace

Drupal\javascript_libraries\Form

Code

public function submitForm(array &$form, \Drupal\Core\Form\FormStateInterface $form_state) {
  $core_lib = \Drupal::config('javascript_libraries.settings')
    ->get('javascript_libraries_core_libraries');
  $core_lib[] = $form_state
    ->getValue('lib');
  \Drupal::configFactory()
    ->getEditable('javascript_libraries.settings')
    ->set('javascript_libraries_core_libraries', $core_lib)
    ->save();
  drupal_set_message('Core library dependency added succesfully');
}