function ccl_actions_ccl_add_link in Custom Contextual Links 7
Same name and namespace in other branches
- 8 ccl_actions/ccl_actions.module \ccl_actions_ccl_add_link()
Hook function to process the contextual links element.
File
- ccl_actions/
ccl_actions.module, line 183 - Implementation of core actions for CCL.
Code
function ccl_actions_ccl_add_link($element, $dest) {
if (isset($element['#element']['#node']->nid)) {
$node = $element['#element']['#node'];
$action_cache = ccl_cache_get('ccl_actions');
// Global elements.
foreach ($action_cache['global'] as $id => $link) {
_ccl_actions_prepare_link($link, $node, $element, $dest);
}
// Content Type.
if (in_array($node->type, array_keys($action_cache['ct']))) {
foreach ($action_cache['ct'][$node->type] as $id => $link) {
_ccl_actions_prepare_link($link, $node, $element, $dest);
}
}
// Individual nodes.
if (in_array($node->nid, array_keys($action_cache['ids']))) {
foreach ($action_cache['ids'][$node->nid] as $id => $link) {
_ccl_actions_prepare_link($link, $node, $element, $dest);
}
}
}
return $element;
}