function custompage_delegate in Custom Page 7
Same name and namespace in other branches
- 6 custompage.module \custompage_delegate()
Find a theme function and/or template file and return content
1 string reference to 'custompage_delegate'
- custompage_menu in ./
custompage.module - Implementation of hook_menu().
File
- ./
custompage.module, line 192 - Custom Page Module
Code
function custompage_delegate($arg) {
global $user;
//Context integration
if (module_exists('context')) {
// context 2
if (function_exists('context_set_by_condition')) {
context_set_by_condition('custompage', $arg);
}
else {
if ($plugin = context_get_plugin('condition', 'custompage')) {
$plugin
->execute($arg);
}
}
}
// Let's prepare some data for this baby.
$data = module_invoke_all('customdata_' . $arg);
$key = custompage_prefix($arg);
$themed = theme($variables = array(
$key,
drupal_get_title(),
$user,
$data,
));
if (trim($themed) == "") {
drupal_set_message("custompage could not find an appropriate theming function or template file for this path [{$arg}].\n <br /><b>The viable options (in ascending priority) are:</b>\n <ul>\n <li>'phptemplate_{$arg}' in any module\n <li>'THEMENAME_{$arg}' in a theme with the name THEMENAME\n <li> " . custompage_prefix($arg) . ".tpl.php template file in a current theme\n </ul>\n Please make sure at least one of these exist and returns a non-empty output" . custompage_clearcache_message(), 'error');
return " ";
//Returning empty leads to undesired effect of getting a blank page
}
else {
return $themed;
}
}