You are here

public function LDAPAuthorizationProvider::buildRowForm in Lightweight Directory Access Protocol (LDAP) 8.3

Same name and namespace in other branches
  1. 8.4 ldap_authorization/src/Plugin/authorization/Provider/LDAPAuthorizationProvider.php \Drupal\ldap_authorization\Plugin\authorization\Provider\LDAPAuthorizationProvider::buildRowForm()

Builds the authorization form row.

Return array.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

int $index: The row number of the mapping.

Overrides ConfigurableAuthorizationPluginBase::buildRowForm

File

ldap_authorization/src/Plugin/authorization/Provider/LDAPAuthorizationProvider.php, line 129

Class

LDAPAuthorizationProvider
The LDAP authorization provider for authorization module.

Namespace

Drupal\ldap_authorization\Plugin\authorization\Provider

Code

public function buildRowForm(array $form, FormStateInterface $form_state, $index = 0) {
  $row = [];

  /** @var \Drupal\authorization\Entity\AuthorizationProfile $profile */
  $profile = $this->configuration['profile'];
  $mappings = $profile
    ->getProviderMappings();
  $row['query'] = [
    '#type' => 'textfield',
    '#title' => t('LDAP query'),
    '#default_value' => isset($mappings[$index]['query']) ? $mappings[$index]['query'] : NULL,
  ];
  $row['is_regex'] = [
    '#type' => 'checkbox',
    '#title' => t('Is this query a regular expression?'),
    '#default_value' => isset($mappings[$index]['is_regex']) ? $mappings[$index]['is_regex'] : NULL,
  ];
  return $row;
}