You are here

public function AnimateEditForm::submitForm in Animate Any 8

Submit for animate_any_settings.

Overrides FormInterface::submitForm

File

src/Form/AnimateEditForm.php, line 133

Class

AnimateEditForm
Provides a edit form for edit/update the animation data from Animation list.

Namespace

Drupal\animate_any\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // Update the data for current element.
  $parent = $form_state
    ->getvalue('parent_class');
  $aid = $form_state
    ->getvalue('aid');
  $identifiers = json_encode($form_state
    ->getvalue('animate_fieldset'));
  $data = \Drupal::database()
    ->update('animate_any_settings');
  $data
    ->fields([
    'parent' => $parent,
    'identifier' => $identifiers,
  ]);
  $data
    ->condition('aid', $aid);
  $valid = $data
    ->execute();
  if ($valid) {
    $this
      ->messenger()
      ->addMessage($this
      ->t('Animation settings updated.'));
  }
}