public function PageContext::setPageContextTitle in Acquia Lift Connector 8
Set page context title.
Parameters
array|string $title: Set page context title.
File
- src/
Service/ Context/ PageContext.php, line 246 - Contains \Drupal\acquia_lift\Service\Context\PageContext.
Class
Namespace
Drupal\acquia_lift\Service\ContextCode
public function setPageContextTitle($title) {
// If markup, strip tags and convert to string.
if (is_array($title) && isset($title['#markup']) && isset($title['#allowed_tags'])) {
$allowed_tags = empty($title['#allowed_tags']) ? '' : '<' . implode('><', $title['#allowed_tags']) . '>';
$title = strip_tags($title['#markup'], $allowed_tags);
}
// If still an array or empty, set title to empty.
if (is_array($title) || empty($title)) {
$this->pageContext['content_title'] = '';
return;
}
// Otherwise set title.
$this->pageContext['content_title'] = $title;
}