public function SocialCoreController::addPageTitle in Open Social 10.3.x
Same name and namespace in other branches
- 10.0.x modules/social_features/social_core/src/Controller/SocialCoreController.php \Drupal\social_core\Controller\SocialCoreController::addPageTitle()
- 10.1.x modules/social_features/social_core/src/Controller/SocialCoreController.php \Drupal\social_core\Controller\SocialCoreController::addPageTitle()
- 10.2.x modules/social_features/social_core/src/Controller/SocialCoreController.php \Drupal\social_core\Controller\SocialCoreController::addPageTitle()
The _title_callback for the node.add route.
Parameters
\Drupal\node\NodeTypeInterface $node_type: The current node.
Return value
string The page title.
File
- modules/
social_features/ social_core/ src/ Controller/ SocialCoreController.php, line 209
Class
- SocialCoreController
- Returns responses for social_core module routes.
Namespace
Drupal\social_core\ControllerCode
public function addPageTitle(NodeTypeInterface $node_type) {
// The node_types that have a different article than a.
$node_types = [
'event' => 'an',
];
// Make sure extensions can change this as well.
\Drupal::moduleHandler()
->alter('social_node_title_prefix_articles', $node_types);
if ($node_type !== NULL && array_key_exists($node_type
->id(), $node_types)) {
return $this
->t('Create @article @name', [
'@article' => $node_types[$node_type
->id()],
'@name' => $node_type
->label(),
]);
}
return $this
->t('Create a @name', [
'@name' => $node_type
->label(),
]);
}