You are here

function SimpleLdapUserMap::drupalAttributeColumns in Simple LDAP 7

Helper function to retrieve column names from a drupal attribute mapping for a Field API field.

Parameters

string $drupal_attribute: The name of the field as declared in the attribute mapping.

Return value

array An array of columns for the field. Defaults to a single element of 'value'.

2 calls to SimpleLdapUserMap::drupalAttributeColumns()
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 301
Class defining the LDAP <-> Drupal user field mappings.

Class

SimpleLdapUserMap
@file Class defining the LDAP <-> Drupal user field mappings.

Code

function drupalAttributeColumns($drupal_attribute) {

  // Look for nested columns in the attribute name, specified by
  // brackets, ie field_foo[bar][baz].
  preg_match_all('/\\[([a-zA-Z0-9_]+)\\]/', $drupal_attribute, $matches);

  // If there are nested columns, use them, otherwise default to value.
  return empty($matches[1]) ? array(
    'value',
  ) : $matches[1];
}