public function SocialGroupController::createFormTitle in Open Social 10.3.x
Same name and namespace in other branches
- 10.0.x modules/social_features/social_group/src/Controller/SocialGroupController.php \Drupal\social_group\Controller\SocialGroupController::createFormTitle()
- 10.1.x modules/social_features/social_group/src/Controller/SocialGroupController.php \Drupal\social_group\Controller\SocialGroupController::createFormTitle()
- 10.2.x modules/social_features/social_group/src/Controller/SocialGroupController.php \Drupal\social_group\Controller\SocialGroupController::createFormTitle()
The _title_callback for the entity.group_content.create_form route.
Parameters
\Drupal\group\Entity\GroupInterface $group: The group to create the group content in.
string $plugin_id: The group content enabler to create content with.
Return value
string The page title.
File
- modules/
social_features/ social_group/ src/ Controller/ SocialGroupController.php, line 231
Class
- SocialGroupController
- Returns responses for Social Group routes.
Namespace
Drupal\social_group\ControllerCode
public function createFormTitle(GroupInterface $group, $plugin_id) {
/** @var \Drupal\group\Plugin\GroupContentEnablerInterface $plugin */
$plugin = $group
->getGroupType()
->getContentPlugin($plugin_id);
$group_content_type = GroupContentType::load($plugin
->getContentTypeConfigId());
// 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 ($group_content_type !== NULL && array_key_exists($group_content_type
->label(), $node_types)) {
return $this
->t('Create @article @name', [
'@article' => $node_types[$group_content_type
->label()],
'@name' => $group_content_type
->label(),
]);
}
return $this
->t('Create a @name', [
'@name' => $group_content_type
->label(),
]);
}