public static function EntityTypeCloneController::arrayReplace in Entity Type Clone 8
Replaces string values recursively in an array.
Parameters
string $find: The string to find in the array values.
string $replace: The replacement string.
array $arr: The array to search.
Return value
array The array with values replaced.
1 call to EntityTypeCloneController::arrayReplace()
- EntityTypeCloneController::copyFieldDisplay in src/
Controller/ EntityTypeCloneController.php
File
- src/
Controller/ EntityTypeCloneController.php, line 27
Class
- EntityTypeCloneController
- Class EntityTypeCloneController.
Namespace
Drupal\entity_type_clone\ControllerCode
public static function arrayReplace($find, $replace, $arr) {
$newArray = [];
foreach ($arr as $key => $value) {
if (is_array($value)) {
$newArray[$key] = self::arrayReplace($find, $replace, $value);
}
else {
$newArray[$key] = str_replace($find, $replace, $value);
}
}
return $newArray;
}