function noderelationships_get_backreferences in Node Relationships 6
Get a list of all 'noderelationships_backref' fields in the system.
Parameters
$nodetype: If set, return information for this content type.
$reset: If TRUE, discard static information and load information from database.
2 calls to noderelationships_get_backreferences()
- noderelationships_cck_backref_sync_fields in ./
noderelationships.inc - Synchronize back reference settings with back reference fields.
- theme_noderelationships_admin_settings_backref in ./
noderelationships.admin.inc - Render the back reference settings form.
File
- ./
noderelationships.inc, line 476 - Common functions for the noderelationships module.
Code
function noderelationships_get_backreferences($nodetype = NULL, $reset = FALSE) {
static $backreferences;
if (!isset($backreferences) || $reset) {
$backreferences = array();
$db_result = db_query("SELECT nfi.field_name, nfi.type_name, nfi.label, nf.global_settings\n FROM {" . content_instance_tablename() . "} nfi\n INNER JOIN {" . content_field_tablename() . "} nf ON nfi.field_name = nf.field_name\n WHERE nf.type = 'noderelationships_backref' AND nf.active = 1\n ORDER BY nfi.weight ASC, nfi.label ASC");
while ($instance = db_fetch_object($db_result)) {
$global_settings = !empty($instance->global_settings) ? (array) unserialize($instance->global_settings) : array();
$field_name = $instance->field_name;
$type_name = $instance->type_name;
if (!isset($backreferences[$type_name])) {
$backreferences[$type_name] = array();
}
$backreferences[$type_name][$field_name] = array(
'widget_label' => $instance->label,
'referrer_type' => $global_settings['referrer_type'],
);
}
}
if (isset($nodetype)) {
return isset($backreferences[$nodetype]) ? $backreferences[$nodetype] : array();
}
return $backreferences;
}