function field_layout_uninstall

Same name in other branches
  1. 8.9.x core/modules/field_layout/field_layout.install \field_layout_uninstall()
  2. 10 core/modules/field_layout/field_layout.install \field_layout_uninstall()
  3. 11.x core/modules/field_layout/field_layout.install \field_layout_uninstall()

Implements hook_uninstall().

File

core/modules/field_layout/field_layout.install, line 34

Code

function field_layout_uninstall() {
    // Reset each entity display to use the one-column layout to best approximate
    // the absence of layouts.
    $entity_save = function (EntityDisplayInterface $entity) {
        if ($entity instanceof EntityDisplayWithLayoutInterface) {
            $entity->setLayoutId('layout_onecol')
                ->save();
        }
    };
    array_map($entity_save, EntityViewDisplay::loadMultiple());
    array_map($entity_save, EntityFormDisplay::loadMultiple());
    // Invalidate the render cache since all content will no longer have a layout.
    Cache::invalidateTags([
        'rendered',
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.