| 1 layout.admin.inc | layout_removal_removes_page($layout) |
Determines whether the deletion or disabling of this layout would remove the page at its path or additional paths.
@since 1.33.0 Modified to return array|FALSE instead of Boolean.
Return value
array|FALSE: Returns an array of paths, including the primary path or additional paths, if the layout creates a page at that path that is the last enabled layout with the same path. FALSE if not.
File
- core/
modules/ layout/ layout.admin.inc, line 3023 - Admin page callbacks for the Layout module.
Code
function layout_removal_removes_page($layout) {
$paths[] = $layout->getPath();
foreach ($layout->additional_paths as $additional_path) {
$paths[] = $additional_path;
}
$removed_pages = array();
foreach ($paths as $path) {
$router_item = menu_get_item($path);
if ($router_item != FALSE) {
$is_layout_page = ($router_item['page_callback'] == 'layout_page_callback');
if ($is_layout_page) {
if (!isset($router_item['map'])) {
// This needs to exist but isn't always set by menu_get_item().
$router_item['map'] = array();
}
if (count(layout_load_multiple_by_router_item($router_item)) == 1) {
$removed_pages[] = $path;
}
}
}
}
return empty($removed_pages) ? FALSE : $removed_pages;
}