class BundleEntityFormBase
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Entity/BundleEntityFormBase.php \Drupal\Core\Entity\BundleEntityFormBase
- 10 core/lib/Drupal/Core/Entity/BundleEntityFormBase.php \Drupal\Core\Entity\BundleEntityFormBase
- 8.9.x core/lib/Drupal/Core/Entity/BundleEntityFormBase.php \Drupal\Core\Entity\BundleEntityFormBase
Class BundleEntityFormBase is a base form for bundle config entities.
Hierarchy
- class \Drupal\Core\Form\FormBase implements \Drupal\Core\Form\FormInterface, \Drupal\Core\DependencyInjection\ContainerInjectionInterface uses \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Logger\LoggerChannelTrait, \Drupal\Core\Messenger\MessengerTrait, \Drupal\Core\Routing\RedirectDestinationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait
- class \Drupal\Core\Entity\EntityForm implements \Drupal\Core\Entity\EntityFormInterface extends \Drupal\Core\Form\FormBase
- class \Drupal\Core\Entity\BundleEntityFormBase extends \Drupal\Core\Entity\EntityForm
- class \Drupal\Core\Entity\EntityForm implements \Drupal\Core\Entity\EntityFormInterface extends \Drupal\Core\Form\FormBase
Expanded class hierarchy of BundleEntityFormBase
5 files declare their use of BundleEntityFormBase
- BlockContentTypeForm.php in core/
modules/ block_content/ src/ BlockContentTypeForm.php - EntityTypeInfo.php in core/
modules/ content_moderation/ src/ EntityTypeInfo.php - NodeTypeForm.php in core/
modules/ node/ src/ NodeTypeForm.php - ShortcutSetForm.php in core/
modules/ shortcut/ src/ ShortcutSetForm.php - VocabularyForm.php in core/
modules/ taxonomy/ src/ VocabularyForm.php
File
-
core/
lib/ Drupal/ Core/ Entity/ BundleEntityFormBase.php, line 8
Namespace
Drupal\Core\EntityView source
class BundleEntityFormBase extends EntityForm {
/**
* Protects the bundle entity's ID property's form element against changes.
*
* This method is assumed to be called on a completely built entity form,
* including a form element for the bundle config entity's ID property.
*
* @param array $form
* The completely built entity bundle form array.
*
* @return array
* The updated entity bundle form array.
*/
protected function protectBundleIdElement(array $form) {
$entity = $this->getEntity();
$id_key = $entity->getEntityType()
->getKey('id');
assert(isset($form[$id_key]));
$element =& $form[$id_key];
// Make sure the element is not accidentally re-enabled if it has already
// been disabled.
if (empty($element['#disabled'])) {
$element['#disabled'] = !$entity->isNew();
}
return $form;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.