public function ExcludeNodeTitleManager::isTitleExcluded in Exclude Node Title 8
Tells if node should get hidden or not.
Parameters
mixed $param: Can be a node object or integer value (nid).
string $view_mode: Node view mode to check.
Return value
bool Returns boolean TRUE if should be hidden, FALSE when not.
Overrides ExcludeNodeTitleManagerInterface::isTitleExcluded
1 call to ExcludeNodeTitleManager::isTitleExcluded()
- ExcludeNodeTitleManager::preprocessTitle in src/
ExcludeNodeTitleManager.php - Remove the title from the variables array.
File
- src/
ExcludeNodeTitleManager.php, line 157
Class
- ExcludeNodeTitleManager
- Service class for Exclude Node Title module settings management.
Namespace
Drupal\exclude_node_titleCode
public function isTitleExcluded($param, $view_mode = 'full') {
if (!($node_info = $this
->getNodeInfo($param))) {
return FALSE;
}
if (!isset($this->excludeSettings)) {
foreach ($this->bundleInfo
->getBundleInfo('node') as $key => $val) {
$this->excludeSettings[$key] = [
'type' => $this
->getBundleExcludeMode($key),
'modes' => $this
->getExcludedViewModes($key),
];
}
}
$node_type = $node_info['node_type'];
$modes = $this->excludeSettings[$node_type]['modes'];
if (!isset($this->excludeSettings[$node_type]['type'])) {
return FALSE;
}
switch ($this->excludeSettings[$node_type]['type']) {
case 'all':
return in_array($view_mode, $modes);
case 'user':
if (!$node_info['nid']) {
return FALSE;
}
if ($this
->isNodeExcluded($node_info['nid'])) {
return in_array($view_mode, $modes);
}
return FALSE;
case 'none':
default:
return FALSE;
}
}