private function DrupalUserProcessor::parseUserAttributeNames in Lightweight Directory Access Protocol (LDAP) 8.3
Same name and namespace in other branches
- 8.4 ldap_user/src/Processor/DrupalUserProcessor.php \Drupal\ldap_user\Processor\DrupalUserProcessor::parseUserAttributeNames()
Parse user attribute names.
Parameters
string $user_attr_key: A string in the form of <attr_type>.<attr_name>[:<instance>] such as field.lname, property.mail, field.aliases:2.
Return value
array An array such as array('field','field_user_lname', NULL).
1 call to DrupalUserProcessor::parseUserAttributeNames()
- DrupalUserProcessor::setUserDefinedMappings in ldap_user/
src/ Processor/ DrupalUserProcessor.php - Sets the additional, user-defined fields.
File
- ldap_user/
src/ Processor/ DrupalUserProcessor.php, line 1182
Class
- DrupalUserProcessor
- Handles processing of a user from LDAP to Drupal.
Namespace
Drupal\ldap_user\ProcessorCode
private function parseUserAttributeNames($user_attr_key) {
// Make sure no [] are on attribute.
$user_attr_key = trim($user_attr_key, TokenProcessor::PREFIX . TokenProcessor::SUFFIX);
$parts = explode('.', $user_attr_key);
$attr_type = $parts[0];
$attr_name = isset($parts[1]) ? $parts[1] : FALSE;
$attr_ordinal = FALSE;
if ($attr_name) {
$attr_name_parts = explode(':', $attr_name);
if (isset($attr_name_parts[1])) {
$attr_name = $attr_name_parts[0];
$attr_ordinal = $attr_name_parts[1];
}
}
return [
$attr_type,
$attr_name,
$attr_ordinal,
];
}