public static ConfigurableLanguage::preDelete(EntityStorageInterface $storage, array $entities)
Throws
\DeleteDefaultLanguageException Exception thrown if we're trying to delete the default language entity. This is not allowed as a site must have a default language.
Overrides ConfigEntityBase::preDelete
File
- core/modules/language/src/Entity/ConfigurableLanguage.php, line 151
Class
- ConfigurableLanguage
- Defines the ConfigurableLanguage entity.
Namespace
Drupal\language\Entity
Code
1 2 3 4 5 6 7 8 | public static function preDelete(EntityStorageInterface $storage , array $entities ) { $default_langcode = static ::getDefaultLangcode(); foreach ( $entities as $entity ) { if ( $entity ->id() == $default_langcode && ! $entity ->isUninstalling()) { throw new DeleteDefaultLanguageException( 'Can not delete the default language' ); } } } |
Please login to continue.