You are here

public function SubgroupDeriver::getDerivativeDefinitions in Subgroup (Graph) 1.0.x

Gets the definition of all derivatives of a base plugin.

Parameters

array $base_plugin_definition: The definition array of the base plugin.

Return value

array An array of full derivative definitions keyed on derivative id.

Overrides DeriverBase::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

src/Plugin/GroupContentEnabler/SubgroupDeriver.php, line 18

Class

SubgroupDeriver
Derives subgroup plugin definitions based on group types types.

Namespace

Drupal\ggroup\Plugin\GroupContentEnabler

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  foreach (GroupType::loadMultiple() as $name => $group_type) {
    $label = $group_type
      ->label();
    $this->derivatives[$name] = [
      'entity_bundle' => $name,
      'label' => t('Subgroup (@type)', [
        '@type' => $label,
      ]),
      'description' => t('Adds %type groups to groups both publicly and privately.', [
        '%type' => $label,
      ]),
    ] + $base_plugin_definition;
  }
  return $this->derivatives;
}