function group_content_menu_get_plugins_per_group in Group Content Menu 8
Get group content menu plugins per group.
Parameters
\Drupal\group\Entity\GroupInterface $group: The group.
Return value
\Drupal\group\Plugin\GroupContentEnablerInterface[] The group menu plugins.
2 calls to group_content_menu_get_plugins_per_group()
- group_content_menu_get_menus_per_group in ./
group_content_menu.module - Get group content menus per group.
- group_content_menu_group_insert in ./
group_content_menu.module - Implements hook_ENTITY_TYPE_insert().
File
- ./
group_content_menu.module, line 175 - Provides a group content menu entity type.
Code
function group_content_menu_get_plugins_per_group(GroupInterface $group) {
$group_type = GroupType::load($group
->bundle());
/** @var \Drupal\group\Plugin\GroupContentEnablerManagerInterface $plugin_manager */
$plugin_manager = \Drupal::service('plugin.manager.group_content_enabler');
$installed = $plugin_manager
->getInstalled($group_type);
return array_filter($installed
->getIterator()
->getArrayCopy(), static function ($plugin_id) {
return strpos($plugin_id, 'group_content_menu:') === 0;
}, ARRAY_FILTER_USE_KEY);
}