1.20.x layout.class.inc Layout::revert()

Revert a layout to a module-provided default.

File

modules/layout/includes/layout.class.inc, line 413
Class for loading, modifying, and executing a layout.

Class

Layout
@file Class for loading, modifying, and executing a layout.

Code

function revert() {
  if (!empty($this->module)) {
    // Restore the module-provided layout config.
    config('layout.layout.' . $this->name)->delete();
    config_install_default_config($this->module, 'layout.layout.' . $this->name);

    // Restore the module-provided menu settings if this layout provides the
    // active menu item.
    if ($this->menu_item && $this->menu_item->name === $this->name) {
      $this->menu_item->revert();
    }
    layout_reset_caches();
    $this->invokeHook('revert');
  }
}