You are here

function _addressfield_tokens_webform_components in Addressfield Tokens 7

Retrieves node components based on Node ID.

Parameters

int $nid: Node ID.

Return value

mixed Components.

File

./addressfield_tokens.module, line 453
Main components.

Code

function _addressfield_tokens_webform_components($nid) {
  $components =& drupal_static(__FUNCTION__, array());
  if (!isset($components[$nid])) {
    $components[$nid] = db_select('webform_component')
      ->fields('webform_component')
      ->condition('type', 'addressfield')
      ->condition('nid', $nid)
      ->execute()
      ->fetchAllAssoc('cid', PDO::FETCH_ASSOC);
  }
  return $components[$nid];
}