You are here

GroupMediaDeriver.php in Group Media 8

Same filename and directory in other branches
  1. 8.2 src/Plugin/GroupContentEnabler/GroupMediaDeriver.php

File

src/Plugin/GroupContentEnabler/GroupMediaDeriver.php
View source
<?php

namespace Drupal\groupmedia\Plugin\GroupContentEnabler;

use Drupal\media_entity\Entity\MediaBundle;
use Drupal\Component\Plugin\Derivative\DeriverBase;
class GroupMediaDeriver extends DeriverBase {

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

}

Classes

Namesort descending Description
GroupMediaDeriver