You are here

private function LdapUserAdminForm::getServerMappingHeader in Lightweight Directory Access Protocol (LDAP) 8.3

Migrated from ldap_user.theme.inc .

1 call to LdapUserAdminForm::getServerMappingHeader()
LdapUserAdminForm::buildForm in ldap_user/src/Form/LdapUserAdminForm.php
Form constructor.

File

ldap_user/src/Form/LdapUserAdminForm.php, line 655

Class

LdapUserAdminForm
Provides the form to configure user configuration and field mapping.

Namespace

Drupal\ldap_user\Form

Code

private function getServerMappingHeader($direction) {
  if ($direction == self::PROVISION_TO_DRUPAL) {
    $header = [
      [
        'data' => $this
          ->t('Source LDAP tokens'),
        'rowspan' => 1,
        'colspan' => 2,
      ],
      [
        'data' => $this
          ->t('Target Drupal attribute'),
        'rowspan' => 1,
      ],
      [
        'data' => $this
          ->t('Synchronization event'),
        'colspan' => count(LdapConfiguration::provisionsDrupalEvents()),
        'rowspan' => 1,
      ],
    ];
    $second_header = [
      [
        'data' => $this
          ->t('Examples:<ul><li>[sn]</li><li>[mail:0]</li><li>[ou:last]</li><li>[sn], [givenName]</li></ul> Constants such as <em>17</em> or <em>imported</em> should not be enclosed in [].'),
        'header' => TRUE,
      ],
      [
        'data' => $this
          ->t('Convert from binary'),
        'header' => TRUE,
      ],
      [
        'data' => '',
        'header' => TRUE,
      ],
    ];
    foreach (LdapConfiguration::provisionsDrupalEvents() as $col_name) {
      $second_header[] = [
        'data' => $col_name,
        'header' => TRUE,
        'class' => 'header-provisioning',
      ];
    }
  }
  else {
    $header = [
      [
        'data' => $this
          ->t('Source Drupal user attribute'),
        'rowspan' => 1,
        'colspan' => 3,
      ],
      [
        'data' => $this
          ->t('Target LDAP token'),
        'rowspan' => 1,
      ],
      [
        'data' => $this
          ->t('Synchronization event'),
        'colspan' => count($this
          ->provisionsLdapEvents()),
        'rowspan' => 1,
      ],
    ];
    $second_header = [
      [
        'data' => $this
          ->t('Note: Select <em>user tokens</em> to use token field.'),
        'header' => TRUE,
      ],
      [
        'data' => $this
          ->t('Source Drupal user tokens such as: <ul><li>[property.name]</li><li>[field.field_fname]</li><li>[field.field_lname]</li></ul> Constants such as <em>from_drupal</em> or <em>18</em> should not be enclosed in [].'),
        'header' => TRUE,
      ],
      [
        'data' => $this
          ->t('Convert From binary'),
        'header' => TRUE,
      ],
      [
        'data' => $this
          ->t('Use singular token format such as: <ul><li>[sn]</li><li>[givenName]</li></ul>'),
        'header' => TRUE,
      ],
    ];
    foreach ($this
      ->provisionsLdapEvents() as $col_name) {
      $second_header[] = [
        'data' => $col_name,
        'header' => TRUE,
        'class' => 'header-provisioning',
      ];
    }
  }
  return [
    'header' => $header,
    'second_header' => $second_header,
  ];
}