public function WebformSubmissionStorage::getFieldDefinitions in Webform 6.x
Same name and namespace in other branches
- 8.5 src/WebformSubmissionStorage.php \Drupal\webform\WebformSubmissionStorage::getFieldDefinitions()
Get webform submission entity field definitions.
The helper method is generally used for exporting results.
Return value
array An associative array of field definition key by field name containing title, name, and datatype.
Overrides WebformSubmissionStorageInterface::getFieldDefinitions
See also
\Drupal\webform\Element\WebformExcludedColumns
\Drupal\webform\Controller\WebformResultsExportController
File
- src/
WebformSubmissionStorage.php, line 116
Class
- WebformSubmissionStorage
- Defines the webform submission storage.
Namespace
Drupal\webformCode
public function getFieldDefinitions() {
/** @var \Drupal\Core\Field\BaseFieldDefinition[] $definitions */
$field_definitions = $this->entityFieldManager
->getBaseFieldDefinitions('webform_submission');
// For now never let any see or export the serialize YAML data field.
unset($field_definitions['data']);
$definitions = [];
foreach ($field_definitions as $field_name => $field_definition) {
// Exclude the 'map' field type which is used by the metatag.module.
if ($field_definition
->getType() === 'map') {
continue;
}
$definitions[$field_name] = [
'title' => $field_definition
->getLabel(),
'name' => $field_name,
'type' => $field_definition
->getType(),
'target_type' => $field_definition
->getSetting('target_type'),
];
}
return $definitions;
}