You are here

function webform_protected_downloads_get_configuration in Webform Protected Downloads 7

Same name and namespace in other branches
  1. 6 webform_protected_downloads.module \webform_protected_downloads_get_configuration()

Get the configuration for the given node

Parameters

int $nid:

string $field optional:

Return value

void

9 calls to webform_protected_downloads_get_configuration()
webform_protected_downloads_component_delete_access in ./webform_protected_downloads.module
Custom access callback that checks wheather a webform component can be deleted
webform_protected_downloads_configuration_form in ./webform_protected_downloads.form.inc
Form callback for the webform configuration subpage
webform_protected_downloads_download_page in ./webform_protected_downloads.page.inc
Displays the download page
webform_protected_downloads_form_alter in ./webform_protected_downloads.module
Implementation of hook_form_alter().
webform_protected_downloads_node_load in ./webform_protected_downloads.module
Implementation of hook_node_load().

... See full list

File

./webform_protected_downloads.module, line 758
This file contains hook declarations and functions for the Webform Protected Downloads module.

Code

function webform_protected_downloads_get_configuration($nid, $field = NULL, $default = NULL) {
  $wpd_node_conf =& drupal_static(__FUNCTION__);
  if (!isset($wpd_node_conf[$nid])) {
    $wpd_node_conf[$nid] = db_query("SELECT * FROM {wpd_node_configuration} WHERE nid = :nid", array(
      ':nid' => $nid,
    ))
      ->fetchObject();
  }
  if ($wpd_node_conf[$nid]) {
    return $field !== NULL ? isset($wpd_node_conf[$nid]->{$field}) && !empty($wpd_node_conf[$nid]->{$field}) ? $wpd_node_conf[$nid]->{$field} : $default : $wpd_node_conf[$nid];
  }
  else {
    return FALSE;
  }
}