class SmsUserMenuLink in SMS Framework 8
Same name and namespace in other branches
- 2.x modules/sms_user/src/Plugin/Derivative/SmsUserMenuLink.php \Drupal\sms_user\Plugin\Derivative\SmsUserMenuLink
- 2.1.x modules/sms_user/src/Plugin/Derivative/SmsUserMenuLink.php \Drupal\sms_user\Plugin\Derivative\SmsUserMenuLink
Provides dynamic menu links for SMS User.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\sms_user\Plugin\Derivative\SmsUserMenuLink implements ContainerDeriverInterface
Expanded class hierarchy of SmsUserMenuLink
See also
\Drupal\views\Plugin\Menu\ViewsMenuLink
1 string reference to 'SmsUserMenuLink'
- sms_user.links.menu.yml in modules/
sms_user/ sms_user.links.menu.yml - modules/sms_user/sms_user.links.menu.yml
File
- modules/
sms_user/ src/ Plugin/ Derivative/ SmsUserMenuLink.php, line 15
Namespace
Drupal\sms_user\Plugin\DerivativeView source
class SmsUserMenuLink extends DeriverBase implements ContainerDeriverInterface {
/**
* The phone number verification service.
*
* @var \Drupal\sms\Provider\PhoneNumberVerificationInterface
*/
protected $phoneNumberVerification;
/**
* Constructs a \Drupal\sms_user\Plugin\Derivative\SmsUserMenuLink instance.
*
* @param \Drupal\sms\Provider\PhoneNumberVerificationInterface $phone_number_verification
* The phone number verification service.
*/
public function __construct(PhoneNumberVerificationInterface $phone_number_verification) {
$this->phoneNumberVerification = $phone_number_verification;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container
->get('sms.phone_number.verification'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$links = [];
if ($this->phoneNumberVerification
->getPhoneNumberSettings('user', 'user')) {
$links['sms_user_phone_number_settings'] = [
'title' => t('User phone number'),
'description' => t('Set up phone number fields and settings for users.'),
'route_name' => 'entity.phone_number_settings.edit_form',
'route_parameters' => [
'phone_number_settings' => 'user.user',
],
'parent' => 'user.admin_index',
'weight' => 21,
];
}
return $links;
}
}
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:: |
|
SmsUserMenuLink:: |
protected | property | The phone number verification service. | |
SmsUserMenuLink:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
SmsUserMenuLink:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
SmsUserMenuLink:: |
public | function | Constructs a \Drupal\sms_user\Plugin\Derivative\SmsUserMenuLink instance. |