You are here

function _webform_attributes_find_record_by_nid in Webform Attributes 7

Same name and namespace in other branches
  1. 7.2 includes/webform_attributes.functions.inc \_webform_attributes_find_record_by_nid()

Find an existing record.

Parameters

int $nid: Node nid.

Return value

array Return array with attributes when found it.

2 calls to _webform_attributes_find_record_by_nid()
webform_attributes_form_webform_client_form_alter in ./webform_attributes.module
Implements hook_form_FORM_ID_alter().
webform_attributes_form_webform_configure_form_alter in ./webform_attributes.module
Implements hook_form_FORM_ID_alter().

File

includes/webform_attributes.functions.inc, line 86
Functions related the Webform Attributes.

Code

function _webform_attributes_find_record_by_nid($nid, $parser = TRUE) {
  $result = db_select('webform_attributes', 'wa')
    ->fields('wa', array(
    'attributes',
  ))
    ->condition('nid', $nid, '=')
    ->execute()
    ->fetchField();
  if (!empty($result)) {
    $result = unserialize($result);
    if ($parser) {
      return _webform_attributes_parser_array_to_string($result);
    }
    return $result;
  }
  return NULL;
}