protected function GroupContentController::addPageBundles in Group 2.0.x
Same name and namespace in other branches
- 8 src/Entity/Controller/GroupContentController.php \Drupal\group\Entity\Controller\GroupContentController::addPageBundles()
Retrieves a list of available bundles for the add page.
Parameters
\Drupal\group\Entity\GroupInterface $group: The group to add the group content to.
bool $create_mode: Whether the target entity still needs to be created.
Return value
array An array of group content type IDs, keyed by the plugin that was used to generate their respective group content types.
See also
::addPage()
1 call to GroupContentController::addPageBundles()
- GroupContentController::addPage in src/
Entity/ Controller/ GroupContentController.php - Provides the group content creation overview page.
1 method overrides GroupContentController::addPageBundles()
- GroupNodeController::addPageBundles in modules/
gnode/ src/ Controller/ GroupNodeController.php - Retrieves a list of available bundles for the add page.
File
- src/
Entity/ Controller/ GroupContentController.php, line 158
Class
- GroupContentController
- Returns responses for GroupContent routes.
Namespace
Drupal\group\Entity\ControllerCode
protected function addPageBundles(GroupInterface $group, $create_mode) {
$bundles = [];
/** @var \Drupal\group\Entity\Storage\GroupContentTypeStorageInterface $storage */
$storage = $this->entityTypeManager
->getStorage('group_content_type');
foreach ($storage
->loadByGroupType($group
->getGroupType()) as $bundle => $group_content_type) {
// Skip the bundle if we are listing bundles that allow you to create an
// entity in the group and the bundle's plugin does not support that.
if ($create_mode && !$group_content_type
->getRelationPlugin()
->definesEntityAccess()) {
continue;
}
$bundles[$group_content_type
->getRelationPluginId()] = $bundle;
}
return $bundles;
}