diff --git a/wire/core/ProcessWire.php b/wire/core/ProcessWire.php index fffb54de..b43f2fa3 100644 --- a/wire/core/ProcessWire.php +++ b/wire/core/ProcessWire.php @@ -45,7 +45,7 @@ class ProcessWire extends Wire { * Reversion revision number * */ - const versionRevision = 67; + const versionRevision = 68; /** * Version suffix string (when applicable) diff --git a/wire/core/Wire.php b/wire/core/Wire.php index f9ee44f3..0f1b769b 100644 --- a/wire/core/Wire.php +++ b/wire/core/Wire.php @@ -1128,14 +1128,27 @@ abstract class Wire implements WireTranslatable, WireFuelable, WireTrackable { * * #pw-group-changes * - * @param bool $getValues Specify true to return an associative array containing an array of previous values, indexed by - * property name, oldest to newest. Requires Wire::trackChangesValues mode to be enabled. + * @param bool $getValues Specify one of the following, or omit for default setting. + * - `false` (bool): return array of changed property names (default setting). + * - `true` (bool): return an associative array containing an array of previous values, indexed by + * property name, oldest to newest. Requires Wire::trackChangesValues mode to be enabled. + * - `2` (int): Return array where both keys and values are changed property names. * @return array * */ public function getChanges($getValues = false) { - if($getValues) return $this->changes; - return array_keys($this->changes); + if($getValues === 2) { + $changes = array(); + foreach($this->changes as $name => $value) { + if($value) {} // value ignored + $changes[$name] = $name; + } + return $changes; + } else if($getValues) { + return $this->changes; + } else { + return array_keys($this->changes); + } }