1 layout.admin.inc layout_toggle_enabled(Layout $layout, $status)

Menu callback; Enable or disable a layout configuration.

File

core/modules/layout/layout.admin.inc, line 2358
Admin page callbacks for the Layout module.

Code

function layout_toggle_enabled(Layout $layout, $status) {
  if (backdrop_get_token('layout-' . $layout->name) !== $_GET['token']) {
    return MENU_ACCESS_DENIED;
  }

  if ($status) {
    $layout->enable();
    backdrop_set_message(t('Layout %title has been enabled.', array('%title' => $layout->title)));
  }
  else {
    $path = $layout->getPath();
    $removal_removes_page = layout_removal_removes_page($layout);
    $layout->disable();
    backdrop_set_message(t('Layout %title has been disabled.', array('%title' => $layout->title)));
    if ($removal_removes_page) {
      layout_warn_if_site_info_path($path, 'disable');
    }
  }
  backdrop_goto('admin/structure/layouts');
}