You are here

public function InviteBlock::getDerivativeDefinitions in Invite 8

Creates a block for each sending method that is enabled on invite_types.

Overrides DeriverInterface::getDerivativeDefinitions

1 call to InviteBlock::getDerivativeDefinitions()
InviteBlock::getDerivativeDefinition in src/Plugin/Derivative/InviteBlock.php
Gets the definition of a derivative plugin.

File

src/Plugin/Derivative/InviteBlock.php, line 26

Class

InviteBlock
InviteBlock Class.

Namespace

Drupal\invite\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $derivatives = [];
  foreach (InviteSender::loadMultiple(\Drupal::entityQuery('invite_sender')
    ->condition('sending_methods', $base_plugin_definition['provider'], 'CONTAINS')
    ->execute()) as $sending_method) {
    $sending_method_id = $sending_method
      ->id();
    $derivatives[$sending_method_id] = $base_plugin_definition;
    $derivatives[$sending_method_id]['admin_label'] = \Drupal::config('invite.invite_type.' . $sending_method_id)
      ->get('label');
  }
  return $derivatives;
}