protected function ConfigBase::castSafeStrings in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Config/ConfigBase.php \Drupal\Core\Config\ConfigBase::castSafeStrings()
- 9 core/lib/Drupal/Core/Config/ConfigBase.php \Drupal\Core\Config\ConfigBase::castSafeStrings()
Casts any objects that implement MarkupInterface to string.
Parameters
mixed $data: The configuration data.
Return value
mixed The data with any safe strings cast to string.
File
- core/
lib/ Drupal/ Core/ Config/ ConfigBase.php, line 284
Class
- ConfigBase
- Provides a base class for configuration objects with get/set support.
Namespace
Drupal\Core\ConfigCode
protected function castSafeStrings($data) {
if ($data instanceof MarkupInterface) {
$data = (string) $data;
}
elseif (is_array($data)) {
array_walk_recursive($data, function (&$value) {
if ($value instanceof MarkupInterface) {
$value = (string) $value;
}
});
}
return $data;
}