1 layout.admin.inc layout_warn_if_site_info_path($path, $op)

Issues warnings if for a layout whose removal removes a page, its path matches one of the paths on the site information page.

Parameters

string $path: The path of the layout (that was just deleted or disabled).

string $op: One of 'delete' or 'disable'.

File

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

Code

function layout_warn_if_site_info_path($path, $op) {
  $site_config = config('system.core');
  switch ($op) {
    case 'delete':
      if ($path == $site_config->get('site_frontpage')) {
        backdrop_set_message(t('You have deleted the page at %path that is used as the home page of the site.', array('%path' => $path)) . ' ' . _layout_site_info_page_message('edit-front-page', t('home page')), 'warning');
      }
      if ($path == $site_config->get('site_403')) {
        backdrop_set_message(t('You have deleted the page at %path that is used as the default 403 (access denied) page of the site.', array('%path' => $path)) . ' ' . _layout_site_info_page_message('edit-error-page', t('403 page')), 'warning');
      }
      if ($path == $site_config->get('site_404')) {
        backdrop_set_message(t('You have deleted the page at %path that is used as the default 404 (not found) page of the site.', array('%path' => $path)) . ' ' . _layout_site_info_page_message('edit-error-page', t('404 page')), 'warning');
      }
      break;

    case 'disable':
      if ($path == $site_config->get('site_frontpage')) {
        backdrop_set_message(t('You have disabled the page at %path that is used as the home page of the site.', array('%path' => $path)) . ' ' . _layout_site_info_page_message('edit-front-page', t('home page')), 'warning');
      }
      if ($path == $site_config->get('site_403')) {
        backdrop_set_message(t('You have disabled the page at %path that is used as the default 403 (access denied) page of the site.', array('%path' => $path)) . ' ' . _layout_site_info_page_message('edit-error-page', t('403 page')), 'warning');
      }
      if ($path == $site_config->get('site_404')) {
        backdrop_set_message(t('You have disabled the the page at %path that is used as the default 404 (not found) page of the site.', array('%path' => $path)) . ' ' . _layout_site_info_page_message('edit-error-page', t('404 page')), 'warning');
      }
      break;
  }
}