public function YamlFormSubmissionStorage::getSourceEntityTypes in YAML Form 8
Get form submission source entity types.
Parameters
\Drupal\yamlform\YamlFormInterface $yamlform: A form.
Return value
array An array of entity types that the form has been submitted from.
Overrides YamlFormSubmissionStorageInterface::getSourceEntityTypes
File
- src/
YamlFormSubmissionStorage.php, line 198
Class
- YamlFormSubmissionStorage
- Defines the form submission storage.
Namespace
Drupal\yamlformCode
public function getSourceEntityTypes(YamlFormInterface $yamlform) {
$entity_types = Database::getConnection()
->select('yamlform_submission', 's')
->distinct()
->fields('s', [
'entity_type',
])
->condition('s.yamlform_id', $yamlform
->id())
->condition('s.entity_type', 'yamlform', '<>')
->orderBy('s.entity_type', 'ASC')
->execute()
->fetchCol();
$entity_type_labels = \Drupal::service('entity_type.repository')
->getEntityTypeLabels();
ksort($entity_type_labels);
return array_intersect_key($entity_type_labels, array_flip($entity_types));
}