You are here

DynamicUserHelpLink.php in Lightweight Directory Access Protocol (LDAP) 8.3

Same filename and directory in other branches
  1. 8.4 ldap_authentication/src/Plugin/Derivative/DynamicUserHelpLink.php

File

ldap_authentication/src/Plugin/Derivative/DynamicUserHelpLink.php
View source
<?php

namespace Drupal\ldap_authentication\Plugin\Derivative;

use Drupal\Component\Plugin\Derivative\DeriverBase;

/**
 * Provides help messages for users when configured.
 */
class DynamicUserHelpLink extends DeriverBase {
  private $config;

  /**
   * Constructor.
   */
  public function __construct() {
    $this->config = \Drupal::config('ldap_authentication.settings');
  }

  /**
   * {@inheritdoc}
   */
  public function getDerivativeDefinitions($basePluginDefinition) {
    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;
  }

}

Classes

Namesort descending Description
DynamicUserHelpLink Provides help messages for users when configured.