function webform_protected_downloads_node_get_private_file_fields in Webform Protected Downloads 7
Retrieve all private file fields.
This actually retrieves fields of types 'file' and 'image'.
Parameters
string $node:
Return value
array
2 calls to webform_protected_downloads_node_get_private_file_fields()
- webform_protected_downloads_configuration_form in ./
webform_protected_downloads.form.inc - Form callback for the webform configuration subpage
- webform_protected_downloads_node_get_private_files in ./
webform_protected_downloads.module - Retrieve private files for the given node
File
- ./
webform_protected_downloads.module, line 480 - This file contains hook declarations and functions for the Webform Protected Downloads module.
Code
function webform_protected_downloads_node_get_private_file_fields($node) {
$private_file_fields =& drupal_static(__FUNCTION__);
if (!isset($private_file_fields[$node->nid])) {
$private_file_fields[$node->nid] = array();
$field_instances = field_info_instances('node', $node->type);
foreach ($field_instances as $field_name => $field) {
$field_info = field_info_field($field_name);
if (in_array($field_info['type'], array(
'file',
'image',
)) && $field_info['settings']['uri_scheme'] == 'private') {
$private_file_fields[$node->nid][] = $field_name;
}
}
}
return $private_file_fields[$node->nid];
}