public function WebformContentCreatorEntity::existsBundle in Webform Content Creator 2.x
Check if the bundle exists.
Return value
bool True, if the bundle exists. Otherwise, returns false.
Overrides WebformContentCreatorInterface::existsBundle
1 call to WebformContentCreatorEntity::existsBundle()
- WebformContentCreatorEntity::createContent in src/
Entity/ WebformContentCreatorEntity.php - Create content entity from webform submission.
File
- src/
Entity/ WebformContentCreatorEntity.php, line 574
Class
- WebformContentCreatorEntity
- Defines the Webform Content Creator entity.
Namespace
Drupal\webform_content_creator\EntityCode
public function existsBundle() {
// Get entity type id.
$entity_type_id = $this
->getEntityTypeValue();
// Get bundle id.
$bundle_id = $this
->getBundleValue();
// Get bundles of entity type being used.
$bundles = \Drupal::service('entity_type.bundle.info')
->getBundleInfo($entity_type_id);
$bundles = array_keys($bundles);
return in_array($bundle_id, $bundles);
}