I have a loader function which is called excessively whenever the user accesses the page. Naturally, I only need it to run once per page request, instead, it is called multiple times. Earlier the _load() ran only twice with MENU_CALLBACK, then I tested it with the default MENU_NORMAL_ITEM and it increased to four. Although I've changed it back, and cleared my cache, it still runs four times now, and I only want it to run once.
My question is, why is my loader function being called multiple times? Any insight would be greatly appreciated.
$items['daycare/%isValid/home'] = array(
'title' => 'Daycare Admin Home',
'page callback' => 'daycares_home_page',
'load arguments' => array(0),//Passes 1st part of url 'daycare' as 2nd arg
'page arguments' => array(0),
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
function isValid_load($pageID, $pageType){
/*Do stuff to validate wildcard part of URL. Will throw 404/403 if invalid*/
return $pageId;
}