public function render($key, $content = null, $recursive = true, $single = false)
{
if (null === $content) {
$content = $this->renderChildren();
}
try {
// extraction from Iterators could potentially use a getter method which throws
// exceptions - although this would be bad practice. Catch the exception here
// and turn it into a WARNING log message so that output does not break.
if (true === (bool) $recursive) {
$result = $this->recursivelyExtractKey($content, $key);
} else {
$result = $this->extractByKey($content, $key);
}
} catch (\Exception $error) {
GeneralUtility::sysLog($error->getMessage(), 'vhs', GeneralUtility::SYSLOG_SEVERITY_WARNING);
$result = [];
}
if (true === (bool) $single) {
return reset($result);
}
return $result;
}