protected function ContextBreadcrumbBuilder::renderData in Context Breadcrumb 8
Render data.
Parameters
string $title: The title.
string|int $renderType: The render type.
array|mixed $data: Context data.
Return value
mixed|string|null Title render output.
1 call to ContextBreadcrumbBuilder::renderData()
- ContextBreadcrumbBuilder::build in src/
Breadcrumb/ ContextBreadcrumbBuilder.php - Builds the breadcrumb.
File
- src/
Breadcrumb/ ContextBreadcrumbBuilder.php, line 200
Class
- ContextBreadcrumbBuilder
- Class ConextBreadcrumbBuilder.
Namespace
Drupal\context_breadcrumb\BreadcrumbCode
protected function renderData($title, $renderType, $data) {
if (strpos($title, '[') !== FALSE && strpos($title, ']') !== FALSE) {
// Render token.
return $this->token
->replace($title, $data);
}
if (strpos($title, '{{') !== FALSE && strpos($title, '}}') !== FALSE) {
$render_array = [
'#type' => 'inline_template',
'#template' => $title,
'#context' => $data,
];
$renderer = \Drupal::service('renderer');
return (string) $renderer
->render($render_array);
}
return $title;
}