protected function ContentModelUpdater::changeNestedValue in Panopoly 8.2
Utility method to change nested value in config data.
Only changes the value if the original value matches an expected value.
Parameters
array $data: The data array.
string $path: The path of the desired data.
mixed $original_value: The expected original value.
mixed $value: The value to set.
string $delimiter: The path delimiter.
Return value
bool Indicates if a change was performed.
2 calls to ContentModelUpdater::changeNestedValue()
- ContentModelUpdater::updateFormDisplay in modules/
panopoly/ panopoly_media/ src/ Update/ ContentModelUpdater.php - Update configuration for entity form displays.
- ContentModelUpdater::updateViewDisplay in modules/
panopoly/ panopoly_media/ src/ Update/ ContentModelUpdater.php - Update configuration for entity view displays.
File
- modules/
panopoly/ panopoly_media/ src/ Update/ ContentModelUpdater.php, line 1148
Class
- ContentModelUpdater
- Applies changes to media content model from schema versions 8204 to 8205.
Namespace
Drupal\panopoly_media\UpdateCode
protected function changeNestedValue(array &$data, $path, $original_value, $value, $delimiter = '::') {
// Strict comparison for bool/null.
if ($original_value === TRUE || $original_value === FALSE || $original_value === NULL) {
if ($this
->getNestedValue($data, $path) !== $original_value) {
return FALSE;
}
}
else {
if ($this
->getNestedValue($data, $path) != $original_value) {
return FALSE;
}
}
$this
->setNestedValue($data, $path, $value);
return TRUE;
}