public function ConfigEntityBundleBas8b7c:f320:99b9:690f:4595:cd17:293a:c069preSave public ConfigEntityBundleBas8b7c:f320:99b9:690f:4595:cd17:293a:c069preSave(EntityStorageInterface $storage) Acts on an entity before the presave hook is invoked. Used before the entity is saved and before invoking the presave hook. Ensure that config entities which are bundles of other entities cannot have their ID changed. Parameters  \Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object. Throws  \Drupal\Core\Config\ConfigNameException Thrown when attempting to rename a bundle entity. Overrides ConfigEntityBas8b7c:f320:99b9:690f:4595:cd17:293a:c069preSave File
 core/lib/Drupal/Core/Config/Entity/ConfigEntityBundleBase.php, line 82  Class
 
ConfigEntityBundleBase  A base class for config entity types that act as bundles.  Namespace Drupal\Core\Config\Entity Code public function preSave(EntityStorageInterface $storage) {
  parent8b7c:f320:99b9:690f:4595:cd17:293a:c069preSave($storage);

  // Only handle renames, not creations.
  if (!$this->isNew() && $this->getOriginalId() !== $this->id()) {
    $bundle_type = $this->getEntityType();
    $bundle_of = $bundle_type->getBundleOf();
    if (!empty($bundle_of)) {
      throw new ConfigNameException("The machine name of the '{$bundle_type->getLabel()}' bundle cannot be changed.");
    }
  }
}


    
{'path': 'public/docs/drupal~8/core-lib-drupal-core-config-entity-configentitybundlebase.php/function/configentitybundlebase-presave/8.1.x.html', 'source': 'DevDocs.IO'}