class MultipleRegistrationLocalTasks in Multiple Registration 8
Same name and namespace in other branches
- 8.2 src/Plugin/Derivative/MultipleRegistrationLocalTasks.php \Drupal\multiple_registration\Plugin\Derivative\MultipleRegistrationLocalTasks
- 3.x src/Plugin/Derivative/MultipleRegistrationLocalTasks.php \Drupal\multiple_registration\Plugin\Derivative\MultipleRegistrationLocalTasks
Defines dynamic local tasks.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\multiple_registration\Plugin\Derivative\MultipleRegistrationLocalTasks implements ContainerDeriverInterface
Expanded class hierarchy of MultipleRegistrationLocalTasks
1 string reference to 'MultipleRegistrationLocalTasks'
File
- src/
Plugin/ Derivative/ MultipleRegistrationLocalTasks.php, line 13
Namespace
Drupal\multiple_registration\Plugin\DerivativeView source
class MultipleRegistrationLocalTasks extends DeriverBase implements ContainerDeriverInterface {
protected $availableUserRolesService;
/**
* The base plugin ID.
*
* @var string
*/
protected $basePluginId;
/**
* MultipleRegistrationLocalTasks constructor.
*
* @param \Drupal\multiple_registration\AvailableUserRolesService $availableUserRolesService
* AvailableUserRolesService service.
* @param string $base_plugin_id
* Base plugin id.
*/
public function __construct(AvailableUserRolesService $availableUserRolesService, $base_plugin_id) {
$this->availableUserRolesService = $availableUserRolesService;
$this->base_plugin_id = $base_plugin_id;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container
->get('multiple_registration.service'), $base_plugin_id);
}
/**
* {@inheritdoc}
*/
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);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
MultipleRegistrationLocalTasks:: |
protected | property | ||
MultipleRegistrationLocalTasks:: |
protected | property | The base plugin ID. | |
MultipleRegistrationLocalTasks:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
MultipleRegistrationLocalTasks:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
MultipleRegistrationLocalTasks:: |
public | function | MultipleRegistrationLocalTasks constructor. |