You are here

public function AvatarKitCommonService::getDerivativeDefinitions in Avatar Kit 8.2

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/Derivative/AvatarKitCommonService.php, line 55

Class

AvatarKitCommonService
Creates services for each Avatar Kit library service.

Namespace

Drupal\avatars\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) : array {
  $services = $this->avatarKitServiceDiscovery
    ->getAvatarServices();
  foreach ($services as $service) {
    $id = $service->id;
    $this->derivatives[$id] = $base_plugin_definition;
    $this->derivatives[$id]['label'] = $service->name;
    $this->derivatives[$id]['description'] = $service->description;
  }
  return $this->derivatives;
}