You are here

public function GroupMediaDeriver::getDerivativeDefinitions in Group Media 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/GroupContentEnabler/GroupMediaDeriver.php \Drupal\groupmedia\Plugin\GroupContentEnabler\GroupMediaDeriver::getDerivativeDefinitions()

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/GroupMediaDeriver.php, line 21

Class

GroupMediaDeriver
Class GroupMediaDeriver.

Namespace

Drupal\groupmedia\Plugin\GroupContentEnabler

Code

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