Skip to content

Commit

Permalink
Get elements Initialized
Browse files Browse the repository at this point in the history
- Seems like removing webform keys makes no change at all once we initialize.
- Will also keep the access key. Because permissions?

Some changes here related also to esmero/webform_strawberryfield@afc0d2b
  • Loading branch information
DiegoPino committed Aug 10, 2022
1 parent 521f52c commit 10c48e9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Plugin/Action/AmiStrawberryfieldJsonAsWebform.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,15 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
}

if ($webform_entity && $chosen_element) {
$myelement = $webform_entity->getElementDecoded($chosen_element);
$myelement = $webform_entity->getElementInitialized($chosen_element);
$libraries = $webform_entity->getSubmissionForm()['#attached']['library'] ?? [];
$form['#attached']['library'] = ($form['#attached']['library'] ?? []) + $libraries;
$cleanelement = [];
foreach($myelement as $key => $value) {
if (strpos($key, '#webform') === FALSE && strpos($key, '#access_') === FALSE) {
/*if (strpos($key, '#webform4') === FALSE && strpos($key, '#access_') === FALSE) {
$cleanelement[$key] = $value;
}
}*/
$cleanelement[$key] = $value;
}
$cleanelement['#required'] = FALSE;
$cleanelement['#validated'] = FALSE;
Expand Down

0 comments on commit 10c48e9

Please sign in to comment.