There is a way to disable the menu cache ?
Context
Drupal 7
I have a custom module that implements hook_menu(). The link is showing up only if a view have results. It's working.
The problem is that I have to clear the drupal cache each time the view changes the number of results because the condition is not triggered anymore.
function gal_custom_menu() {
$items['exhibitions'] = array(
'title' => t('Current exhibition'),
'page callback' => 'gal_exhibition_callback',
'access arguments' => array('access content'),
);
return $items;
}
function gal_exhibition_callback() {
$x = views_get_view_result('exhibition', 'page');
if(count($x)) {
$path = drupal_get_path_alias('node/' . $x[0]->nid);
drupal_goto($path);
} else {
return FALSE;
}
}
Do you have any idea how can I disable the menu cache ? Or is it the Views cache ?
Thanks
hook_menu
is cached the definition of menu items but not the page callback result.$x
(you can usedpm()
) and comment out the code after it. You should always see the same value even the view changed.