public function BulkEditFormTrait::submitConfigurationForm in Views Bulk Edit 8.2
Save modified entity field values to action configuration.
Parameters
array $form: Form array.
\Drupal\Core\Form\FormStateInterface $form_state: The form_state object.
1 call to BulkEditFormTrait::submitConfigurationForm()
- BulkEditForm::submitForm in src/
Form/ BulkEditForm.php - Form submission handler.
File
- src/
Form/ BulkEditFormTrait.php, line 380
Class
- BulkEditFormTrait
- Common methods for Views Bulk Edit forms.
Namespace
Drupal\views_bulk_edit\FormCode
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
$storage = $form_state
->getStorage();
$bundle_data = $storage['vbe_entity_bundles_data'];
foreach ($bundle_data as $entity_type_id => $bundles) {
$entity_type = $this->entityTypeManager
->getDefinition($entity_type_id);
foreach ($bundles as $bundle => $label) {
$field_data = $form_state
->getValue([
$entity_type_id,
$bundle,
]);
$modify = array_filter($field_data['_field_selector']);
if (!empty($modify)) {
$form_clone = $form;
$form_clone['#parents'] = [
$entity_type_id,
$bundle,
];
$entity = $this->entityTypeManager
->getStorage($entity_type_id)
->create([
$entity_type
->getKey('bundle') => $bundle,
]);
$form_display = EntityFormDisplay::collectRenderDisplay($entity, 'bulk_edit');
$form_display
->extractFormValues($entity, $form_clone, $form_state);
foreach (array_keys($modify) as $field) {
$this->configuration[$entity_type_id][$bundle]['values'][$field] = $entity->{$field}
->getValue();
$this->configuration[$entity_type_id][$bundle]['change_method'][$field] = $field_data["{$field}_change_method"];
}
$this->configuration[$entity_type_id][$bundle]['revision_information'] = $field_data['revision_information'] ?? [];
}
}
}
}