Commit 8739d3ab authored by TravisCarden's avatar TravisCarden

By TravisCarden: Sort saved progress elements alphabetically.

parent df0a9acf
...@@ -148,6 +148,7 @@ class ChecklistapiChecklist { ...@@ -148,6 +148,7 @@ class ChecklistapiChecklist {
'#changed_by' => $user->uid, '#changed_by' => $user->uid,
'#completed_items' => 0, '#completed_items' => 0,
); );
// Loop through groups. // Loop through groups.
foreach ($values as $group_key => $group) { foreach ($values as $group_key => $group) {
// Loop through items. // Loop through items.
...@@ -182,6 +183,12 @@ class ChecklistapiChecklist { ...@@ -182,6 +183,12 @@ class ChecklistapiChecklist {
} }
} }
} }
// Sort array elements alphabetically so changes to the order of tasks in
// checklist definitions over time don't affect the order of elements in the
// saved progress variable. This simplifies use with Strongarm.
ksort($progress);
variable_set($this->getSavedProgressVariableName(), $progress); variable_set($this->getSavedProgressVariableName(), $progress);
drupal_set_message(format_plural( drupal_set_message(format_plural(
$changed_items_counter, $changed_items_counter,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment