function safeword_context_context_page_condition in Safeword 7
Same name and namespace in other branches
- 8 safeword_context/safeword_context.module \safeword_context_context_page_condition()
Implements hook_context_page_condition().
File
- safeword_context/
safeword_context.module, line 34
Code
function safeword_context_context_page_condition() {
if ($plugin = context_get_plugin('condition', 'safeword')) {
$item = menu_get_item();
if ($item['load_functions']) {
$loader_index = key($item['load_functions']);
$loader = @$item['load_functions'][$loader_index];
if ($loader) {
$entity_type = substr($loader, 0, -5);
$entity_info = entity_get_info();
if (isset($entity_info[$entity_type])) {
$entity = $item['map'][$loader_index];
$op = isset($item['original_map'][$loader_index + 1]) ? $item['original_map'][$loader_index + 1] : 'view';
$plugin
->execute($entity_type, $entity, $op);
}
}
}
}
}