Is there a way in Drupal 7 to find out if a specific node is used in any panel of any page?
Would be helpful to prevent my editors from deleting content when it's still needed in some other part of the page.
You are looking for something along the lines of file_usage_list()
I guess. I also assume that you are interested in the "Add content > Existing node" functionality of Panels.
You could implement your own function, with the following code:
function _panels_node_usage_list() {
$result = db_query(
"SELECT * FROM {panels_pane} WHERE type = 'node' AND subtype = 'node'"
);
$node_usage_list = array();
foreach ($result as $pane) {
$pane_configuration = unserialize($pane->configuration);
$node_usage_list[$pane_configuration['nid']]++;
}
return $node_usage_list;
}
and then call this function from your own implementation of hook_node_access()
where you can check if the nid of the node to be deleted is in the array returned by _panels_node_usage_list()
.
Good luck!