class FlagTracker in Flag Lists 8
Same name and namespace in other branches
- 4.0.x src/FlagTracker.php \Drupal\flag_lists\FlagTracker
Class FlagTracker.
Tracks updating of flags.
Hierarchy
- class \Drupal\flag_lists\FlagTracker
Expanded class hierarchy of FlagTracker
1 file declares its use of FlagTracker
- flag_lists.module in ./
flag_lists.module - Contains flag_lists.module.
File
- src/
FlagTracker.php, line 13
Namespace
Drupal\flag_listsView source
class FlagTracker {
/**
* {@inheritdoc}
*
* Add a FlagForLists record in the database.
*
* @param array $form
* The form associative array.
* @param Drupal\Core\Form\FormStateInterface $form_state
* The formState array.
*/
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();
}
/**
* {@inheritdoc}
*
* Update a FlagForLists record in the database.
*
* @param array $form
* The form associative array.
* @param Drupal\Core\Form\FormStateInterface $form_state
* The formState array.
* @param Drupal\flag_lists\FlagForList $flagTemplate
* The FlagForList to be update.
*/
public static function update(array $form, FormStateInterface $form_state, FlagForList $flagTemplate) {
$flagTemplate
->set('label', $form_state
->getValue('label'));
$flagTemplate
->setOwner();
$flagTemplate
->save();
}
/**
* Delete a FlagForLists record in the database.
*/
public function delete() {
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FlagTracker:: |
public | function | Delete a FlagForLists record in the database. | |
FlagTracker:: |
public static | function | Add a FlagForLists record in the database. | |
FlagTracker:: |
public static | function | Update a FlagForLists record in the database. |