$hascustommenu = (empty($PAGE->layout_options['nocustommenu']) && !empty($custommenu));
This relates to the Page layout when the custom menu is required on the page. The 'option' relates to all the places where the custom menu is not required on a page. These options are set in the themes config.php under $TMEME->layouts.