public function WebformSubmissionStorage::getSourceEntityTypes in Webform 6.x
Same name and namespace in other branches
- 8.5 src/WebformSubmissionStorage.php \Drupal\webform\WebformSubmissionStorage::getSourceEntityTypes()
Get webform submission source entity types.
Parameters
\Drupal\webform\WebformInterface $webform: A webform.
Return value
array An array of entity types that the webform has been submitted from.
Overrides WebformSubmissionStorageInterface::getSourceEntityTypes
File
- src/
WebformSubmissionStorage.php, line 492
Class
- WebformSubmissionStorage
- Defines the webform submission storage.
Namespace
Drupal\webformCode
public function getSourceEntityTypes(WebformInterface $webform) {
$entity_types = Database::getConnection()
->select('webform_submission', 's')
->distinct()
->fields('s', [
'entity_type',
])
->condition('s.webform_id', $webform
->id())
->condition('s.entity_type', 'webform', '<>')
->orderBy('s.entity_type', 'ASC')
->execute()
->fetchCol();
$entity_type_labels = $this->entityTypeRepository
->getEntityTypeLabels();
ksort($entity_type_labels);
return array_intersect_key($entity_type_labels, array_flip($entity_types));
}