1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-09 08:17:12 +02:00

Adjustment in Wire class and bump version to 3.0.68

This commit is contained in:
Ryan Cramer
2017-07-21 13:08:05 -04:00
parent 506f66b64a
commit f5d8633590
2 changed files with 18 additions and 5 deletions

View File

@@ -45,7 +45,7 @@ class ProcessWire extends Wire {
* Reversion revision number
*
*/
const versionRevision = 67;
const versionRevision = 68;
/**
* Version suffix string (when applicable)

View File

@@ -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);
}
}