You are here

public function MultipleRegistrationLocalTasks::getDerivativeDefinitions in Multiple Registration 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Derivative/MultipleRegistrationLocalTasks.php \Drupal\multiple_registration\Plugin\Derivative\MultipleRegistrationLocalTasks::getDerivativeDefinitions()
  2. 3.x src/Plugin/Derivative/MultipleRegistrationLocalTasks.php \Drupal\multiple_registration\Plugin\Derivative\MultipleRegistrationLocalTasks::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/Derivative/MultipleRegistrationLocalTasks.php, line 49

Class

MultipleRegistrationLocalTasks
Defines dynamic local tasks.

Namespace

Drupal\multiple_registration\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $regPages = $this->availableUserRolesService
    ->getRegistrationPages();
  if (!empty($regPages)) {
    foreach ($regPages as $rid => $role) {
      if ($role['hidden'] === 1) {
        continue;
      }
      $this->derivatives[$rid] = [];
      $this->derivatives[$rid]['title'] = t('Create new @role account', [
        '@role' => $role['role_name'],
      ]);
      $this->derivatives[$rid]['base_route'] = 'user.page';
      $this->derivatives[$rid]['route_name'] = 'multiple_registration.role_registration_page';
      $this->derivatives[$rid]['route_parameters'] = [
        'rid' => $rid,
      ];
    }
  }
  return parent::getDerivativeDefinitions($base_plugin_definition);
}