You are here

function webform_protected_downloads_get_configuration in Webform Protected Downloads 6

Same name and namespace in other branches
  1. 7 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

8 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(). Doc says that $form_state is passed by reference, but that generates warnings: warning: Parameter 2 to webform_protected_downloads_form_alter() expected to be a reference, value given in /includes/common.inc on…
webform_protected_downloads_process_submissions in ./webform_protected_downloads.module
Process unprocessed webform submissions

... See full list

File

./webform_protected_downloads.module, line 606
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) {
  static $wpd_node_conf;
  if (!isset($wpd_node_conf[$nid])) {
    $result = db_query("SELECT * FROM {wpd_node_configuration} WHERE nid = %d", $nid);
    $wpd_node_conf[$nid] = db_fetch_object($result);
  }
  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;
  }
}