You are here

public static function FlagTracker::save in Flag Lists 8

Same name and namespace in other branches
  1. 4.0.x src/FlagTracker.php \Drupal\flag_lists\FlagTracker::save()

Add a FlagForLists record in the database.

Parameters

array $form: The form associative array.

Drupal\Core\Form\FormStateInterface $form_state: The formState array.

1 call to FlagTracker::save()
flag_lists_save_submit in ./flag_lists.module
Form submission handler for the 'save' action.

File

src/FlagTracker.php, line 25

Class

FlagTracker
Class FlagTracker.

Namespace

Drupal\flag_lists

Code

public static function save(array $form, FormStateInterface $form_state) {
  $flagValues = $form_state
    ->getValues();
  $build_array = [];
  $build_array['id'] = $flagValues['id'];
  $build_array['label'] = $flagValues['label'];
  $flagForList = new FlagForList($build_array, 'flag_for_list');
  $flagForList
    ->setBaseFlag($flagValues['id']);
  $flagForList
    ->setOwner();
  $flagForList
    ->save();
}