You are here

class DynamicUserHelpLink in Lightweight Directory Access Protocol (LDAP) 8.4

Same name and namespace in other branches
  1. 8.3 ldap_authentication/src/Plugin/Derivative/DynamicUserHelpLink.php \Drupal\ldap_authentication\Plugin\Derivative\DynamicUserHelpLink

Provides help messages for users when configured.

Hierarchy

Expanded class hierarchy of DynamicUserHelpLink

1 string reference to 'DynamicUserHelpLink'
ldap_authentication.links.task.yml in ldap_authentication/ldap_authentication.links.task.yml
ldap_authentication/ldap_authentication.links.task.yml

File

ldap_authentication/src/Plugin/Derivative/DynamicUserHelpLink.php, line 15

Namespace

Drupal\ldap_authentication\Plugin\Derivative
View source
class DynamicUserHelpLink extends DeriverBase implements ContainerDeriverInterface {

  /**
   * Config.
   *
   * @var \Drupal\Core\Config\Config|\Drupal\Core\Config\ImmutableConfig
   */
  private $config;

  /**
   * Constructor.
   *
   * @param \Drupal\Core\Config\ConfigFactory $config_factory
   *   Config Factory.
   */
  public function __construct(ConfigFactory $config_factory) {
    $this->config = $config_factory
      ->get('ldap_authentication.settings');
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, $base_plugin_id) : DynamicUserHelpLink {
    return new static($container
      ->get('config.factory'));
  }

  /**
   * {@inheritdoc}
   */
  public function getDerivativeDefinitions($basePluginDefinition) : array {
    if ($this->config
      ->get('ldapUserHelpLinkText') && $this->config
      ->get('ldapUserHelpLinkUrl')) {
      $basePluginDefinition['title'] = $this->config
        ->get('ldapUserHelpLinkText');
      $basePluginDefinition['route_name'] = 'ldap_authentication.ldap_help_redirect';
      $this->derivatives['ldap_authentication.show_user_help_link'] = $basePluginDefinition;
    }
    return $this->derivatives;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DeriverBase::$derivatives protected property List of derivative definitions. 1
DeriverBase::getDerivativeDefinition public function Gets the definition of a derivative plugin. Overrides DeriverInterface::getDerivativeDefinition
DynamicUserHelpLink::$config private property Config.
DynamicUserHelpLink::create public static function Creates a new class instance. Overrides ContainerDeriverInterface::create
DynamicUserHelpLink::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverBase::getDerivativeDefinitions
DynamicUserHelpLink::__construct public function Constructor.