1 layout.module | _layout_get_all_info($data_type, $init = array()) |
Load layout-related information from modules.
File
- core/
modules/ layout/ layout.module, line 1610 - The Layout module creates pages and wraps existing pages in layouts.
Code
function _layout_get_all_info($data_type, $init = array()) {
$all_info = &backdrop_static(__FUNCTION__);
if (!isset($all_info[$data_type])) {
_layout_include_files();
$all_info[$data_type] = $init;
foreach (module_implements($data_type . '_info') as $module) {
$function = $module . '_' . $data_type . '_info';
// A module implements deprecated hook_layout_info(), which has been
// renamed in 1.30.0.
if ($data_type == 'layout') {
$link = l(t('Change record: @hook_old has been renamed to @hook_new.', array(
'@hook_old' => 'hook_layout_info()',
'@hook_new' => 'hook_layout_template_info()',
)), 'https://docs.backdropcms.org/change-records/hook_layout_info-renamed-to-hook_layout_template_info');
// We can not use watchdog_deprecated_function() here, as its message
// would misleadingly point to this function instead of the actual hook
// implementation.
$placeholders = array(
'%module' => $module,
'%hook' => 'hook_layout_info()',
'%function' => $function . '()',
);
watchdog('layout', 'Module %module implements deprecated %hook in %function.', $placeholders, WATCHDOG_DEPRECATED, $link);
}
$data = $function();
$module_path = backdrop_get_path('module', $module);
foreach ($data as $key => $info) {
$info['module'] = $module;
$info['name'] = $key;
if (isset($info['path'])) {
$info['path'] = $module_path . '/' . $info['path'];
}
else {
$info['path'] = $module_path;
}
$all_info[$data_type][$key] = $info;
}
}
}
return $all_info[$data_type];
}