public function RealisticDummyContentFileGroup::value in Realistic Dummy Content 3.x
Same name and namespace in other branches
- 8.2 api/src/includes/RealisticDummyContentFileGroup.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentFileGroup::value()
- 7.2 api/src/includes/RealisticDummyContentFileGroup.php \Drupal\realistic_dummy_content_api\includes\RealisticDummyContentFileGroup::value()
Returns the value of the radical file if one exists.
Return value
string An empty string if a radical file does not exist, if it does not have contents, or if an error occurred. Otherwise returns the contents of the file.
File
- api/
src/ includes/ RealisticDummyContentFileGroup.php, line 136
Class
- RealisticDummyContentFileGroup
- Represents files as groups.
Namespace
Drupal\realistic_dummy_content_api\includesCode
public function value() {
try {
$file = $this
->getFile();
if (isset($file->uri)) {
return trim(RealisticDummyContentEnvironment::get()
->fileGetContents($file->uri));
}
else {
return '';
}
} catch (\Throwable $e) {
return '';
}
}