public function GroupMenuController::addPage in Group Menu 8
Provides the group content creation overview page.
Parameters
\Drupal\group\Entity\GroupInterface $group: The group to add the group content to.
bool $create_mode: (optional) Whether the target entity still needs to be created. Defaults to FALSE, meaning the target entity is assumed to exist already.
Return value
array|\Symfony\Component\HttpFoundation\RedirectResponse The group content creation overview page or a redirect to the form for adding group content if there is only one group content type.
Overrides GroupContentController::addPage
File
- src/
Controller/ GroupMenuController.php, line 89
Class
- GroupMenuController
- Returns responses for 'group_menu' GroupContent routes.
Namespace
Drupal\groupmenu\ControllerCode
public function addPage(GroupInterface $group, $create_mode = FALSE) {
$build = parent::addPage($group, $create_mode);
// Do not interfere with redirects.
if (!is_array($build)) {
return $build;
}
// Retrieve all of the responsible group content types, keyed by plugin ID.
foreach ($this
->addPageBundles($group, $create_mode) as $plugin_id => $bundle_name) {
/** @var \Drupal\group\Entity\GroupContentTypeInterface $group_content_type */
if (!empty($build['#bundles'][$bundle_name])) {
$build['#bundles'][$bundle_name]['label'] = $this
->t('Menu');
$build['#bundles'][$bundle_name]['description'] = $this
->t('Create a menu for the group.');
}
}
return $build;
}