function ConfigEntityBundleBase::deleteDisplays

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php \Drupal\Core\Config\Entity\ConfigEntityBundleBase::deleteDisplays()
  2. 10 core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php \Drupal\Core\Config\Entity\ConfigEntityBundleBase::deleteDisplays()
  3. 11.x core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php \Drupal\Core\Config\Entity\ConfigEntityBundleBase::deleteDisplays()

Deletes display if a bundle is deleted.

File

core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php, line 19

Class

ConfigEntityBundleBase
A base class for config entity types that act as bundles.

Namespace

Drupal\Core\Config\Entity

Code

protected function deleteDisplays() {
    // Remove entity displays of the deleted bundle.
    if ($displays = $this->loadDisplays('entity_view_display')) {
        $storage = $this->entityTypeManager()
            ->getStorage('entity_view_display');
        $storage->delete($displays);
    }
    // Remove entity form displays of the deleted bundle.
    if ($displays = $this->loadDisplays('entity_form_display')) {
        $storage = $this->entityTypeManager()
            ->getStorage('entity_form_display');
        $storage->delete($displays);
    }
}

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