public function SkypeManager::loadSkypeChatCanvas in Skype 8
Checks if shield has to be shown on current page.
Return value
bool
File
- src/
Manager/ SkypeManager.php, line 41
Class
Namespace
Drupal\skype\ManagerCode
public function loadSkypeChatCanvas() {
$page_match =& drupal_static(__FUNCTION__);
if (!$this->config
->get('enable_chat')) {
return FALSE;
}
// Cache visibility result if function is called more than once.
if (!isset($page_match)) {
$visibility_path_mode = $this->config
->get('exclude_mode');
$visibility_path_pages = $this->config
->get('exclude_pages');
// Match path if necessary.
if (!empty($visibility_path_pages)) {
// Convert path to lowercase. This allows comparison of the same path
// with different case. Ex: /Page, /page, /PAGE.
$pages = mb_strtolower($visibility_path_pages);
// Compare the lowercase path alias (if any) and internal path.
$path = $this->currentPath
->getPath();
$path_alias = mb_strtolower($this->aliasManager
->getAliasByPath($path));
$page_match = $this->pathMatcher
->matchPath($path_alias, $pages) || $path != $path_alias && $this->pathMatcher
->matchPath($path, $pages);
// When $visibility_request_path_mode has a value of 0, the shield
// is displayed on all pages except those listed in $pages. When
// set to 1, it is displayed only on those pages listed in $pages.
$page_match = !($visibility_path_mode xor $page_match);
}
else {
$page_match = TRUE;
}
}
return $page_match;
}