You are here

public function AnimateAnyForm::submitForm in Animate Any 8

Submit for Animate Any Settings Form.

Overrides FormInterface::submitForm

File

src/Form/AnimateAnyForm.php, line 168

Class

AnimateAnyForm
Provides the Animate Any form.

Namespace

Drupal\animate_any\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $op = (string) $form_state
    ->getValue('op');
  if ($op == $this
    ->t('Save Settings')) {
    $parent = $form_state
      ->getValue('parent_class');
    $identifiers = json_encode($form_state
      ->getValue('animate_fieldset'));
    $db = \Drupal::database();
    $db
      ->insert('animate_any_settings')
      ->fields([
      'parent' => $parent,
      'identifier' => $identifiers,
    ])
      ->execute();
    $this
      ->messenger()
      ->addMessage($this
      ->t('Animation added for @parent.', [
      '@parent' => $parent,
    ]));
  }
}