public function SocialTopicController::latestTopicsPageTitle in Open Social 8
Same name and namespace in other branches
- 8.9 modules/social_features/social_topic/src/Controller/SocialTopicController.php \Drupal\social_topic\Controller\SocialTopicController::latestTopicsPageTitle()
- 8.2 modules/social_features/social_topic/src/Controller/SocialTopicController.php \Drupal\social_topic\Controller\SocialTopicController::latestTopicsPageTitle()
- 8.3 modules/social_features/social_topic/src/Controller/SocialTopicController.php \Drupal\social_topic\Controller\SocialTopicController::latestTopicsPageTitle()
- 8.4 modules/social_features/social_topic/src/Controller/SocialTopicController.php \Drupal\social_topic\Controller\SocialTopicController::latestTopicsPageTitle()
- 8.5 modules/social_features/social_topic/src/Controller/SocialTopicController.php \Drupal\social_topic\Controller\SocialTopicController::latestTopicsPageTitle()
- 8.6 modules/social_features/social_topic/src/Controller/SocialTopicController.php \Drupal\social_topic\Controller\SocialTopicController::latestTopicsPageTitle()
- 8.7 modules/social_features/social_topic/src/Controller/SocialTopicController.php \Drupal\social_topic\Controller\SocialTopicController::latestTopicsPageTitle()
- 8.8 modules/social_features/social_topic/src/Controller/SocialTopicController.php \Drupal\social_topic\Controller\SocialTopicController::latestTopicsPageTitle()
- 10.3.x modules/social_features/social_topic/src/Controller/SocialTopicController.php \Drupal\social_topic\Controller\SocialTopicController::latestTopicsPageTitle()
- 10.0.x modules/social_features/social_topic/src/Controller/SocialTopicController.php \Drupal\social_topic\Controller\SocialTopicController::latestTopicsPageTitle()
- 10.1.x modules/social_features/social_topic/src/Controller/SocialTopicController.php \Drupal\social_topic\Controller\SocialTopicController::latestTopicsPageTitle()
- 10.2.x modules/social_features/social_topic/src/Controller/SocialTopicController.php \Drupal\social_topic\Controller\SocialTopicController::latestTopicsPageTitle()
The _title_callback for the latest topics view.
Return value
string The page title.
File
- modules/
social_features/ social_topic/ src/ Controller/ SocialTopicController.php, line 70
Class
- SocialTopicController
- Returns responses for Social Topic routes.
Namespace
Drupal\social_topic\ControllerCode
public function latestTopicsPageTitle() {
$title = $this
->t('All topics');
// TODO This might change depending on the view exposed filter settings.
$topic_type_id = $this->requestStack
->getCurrentRequest()
->get('field_topic_type_target_id');
$term = NULL;
if ($topic_type_id !== NULL) {
// Topic type can be "All" will crash overview on /newest-topics.
if (is_numeric($topic_type_id)) {
$term = $this->entityTypeManager
->getStorage('taxonomy_term')
->load($topic_type_id);
if ($term
->access('view') && $term
->getVocabularyId() === 'topic_types') {
$term_title = $term
->getName();
$title = $this
->t('Topics of type @type', [
'@type' => $term_title,
]);
}
}
}
// Call hook_topic_type_title_alter().
$this->moduleHandler
->alter('topic_type_title', $title, $term);
return $title;
}