protected function GroupEventController::addPageBundles in Event 8
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.
Overrides GroupContentController::addPageBundles
See also
::addPage()
1 call to GroupEventController::addPageBundles()
- GroupEventController::addPage in modules/
gevent/ src/ Controller/ GroupEventController.php - Provides the group content creation overview page.
File
- modules/
gevent/ src/ Controller/ GroupEventController.php, line 92
Class
- GroupEventController
- Returns responses for 'group_event' GroupContent routes.
Namespace
Drupal\gevent\ControllerCode
protected function addPageBundles(GroupInterface $group, $create_mode) {
$bundles = [];
// Retrieve all group_event plugins for the group's type.
$plugin_ids = $this->pluginManager
->getInstalledIds($group
->getGroupType());
foreach ($plugin_ids as $key => $plugin_id) {
if (strpos($plugin_id, 'group_event:') !== 0) {
unset($plugin_ids[$key]);
}
}
// Retrieve all of the responsible group content types, keyed by plugin ID.
$storage = $this->entityTypeManager
->getStorage('group_content_type');
$properties = [
'group_type' => $group
->bundle(),
'content_plugin' => $plugin_ids,
];
foreach ($storage
->loadByProperties($properties) as $bundle => $group_content_type) {
/** @var \Drupal\group\Entity\GroupContentTypeInterface $group_content_type */
$bundles[$group_content_type
->getContentPluginId()] = $bundle;
}
return $bundles;
}