function SimpleLdapUserMap::parseDrupalAttribute in Simple LDAP 7
Helper function to parse a drupal field name, as mapped to in the variable called simple_ldap_user_attribute_map.
Parameters
string $drupal_attribute: The string name of the field.
Return value
array An array containing a boolean value to signify whether the field is a Field API field, and the actual field name that was matched.
3 calls to SimpleLdapUserMap::parseDrupalAttribute()
- SimpleLdapUserMap::disableMappedFormFields in simple_ldap_user/
SimpleLdapUserMap.class.php - Disable mapped Drupal fields in a form. Used in user profile forms when the server is readonly.
- SimpleLdapUserMap::mapFromDrupalToLdap in simple_ldap_user/
SimpleLdapUserMap.class.php - Map from Drupal to LDAP.
- SimpleLdapUserMap::mapFromLdapToDrupal in simple_ldap_user/
SimpleLdapUserMap.class.php - Map from LDAP to Drupal.
File
- simple_ldap_user/
SimpleLdapUserMap.class.php, line 279 - Class defining the LDAP <-> Drupal user field mappings.
Class
- SimpleLdapUserMap
- @file Class defining the LDAP <-> Drupal user field mappings.
Code
function parseDrupalAttribute($drupal_attribute) {
// Use a regex to capture the name only, not the leading hash or any
// trailing field columns inside of brackets.
preg_match('/^(#?)([a-zA-Z0-9_]+)/', $drupal_attribute, $matches);
// Parse the matches we want to some variables.
list(, $is_field, $field_name) = $matches;
// If field name is empty, the match failed.
if (empty($field_name)) {
return FALSE;
}
return array(
(bool) $is_field,
$field_name,
);
}