Skip to content

Commit

Permalink
Merge pull request #57 from esmero/ISSUE-26b
Browse files Browse the repository at this point in the history
Issue 26b: declutter webform ingest
  • Loading branch information
DiegoPino authored Jul 14, 2020
2 parents af22cab + d3aa69f commit 0c1926b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
8 changes: 7 additions & 1 deletion js/hidenodeaction-webform_strawberryfield.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,20 @@
Entity Form.
*/
$('.path-node .node-form div[data-drupal-selector="edit-actions"]').not('.webform-actions').show();
$('.path-node .node-form div[data-drupal-selector="edit-footer"]').not('.webform-actions').show();
$('.webform-confirmation').closest('[data-strawberryfield-selector="strawberry-webform-widget"]').each(function() {
var $id = $(this).attr('id') + '-strawberry-webform-close-modal';
$('#' + $id).toggleClass('js-hide');
})


} else if ($('div.field--widget-strawberryfield-webform-inline-widget').length) {
} else if (
$('div.field--widget-strawberryfield-webform-inline-widget form.webform-submission-form').length ||
$('div.field--widget-strawberryfield-webform-widget form.webform-submission-form').length
)
{
$('.path-node .node-form div[data-drupal-selector="edit-actions"]').not('.webform-actions').hide();
$('.path-node .node-form div[data-drupal-selector="edit-footer"]').not('.webform-actions').hide();
}
var $moderationstate = $('select[data-drupal-selector="edit-moderation-state-0-state"]', context).once('show-hide-actions');
if ($moderationstate.length) {
Expand Down
8 changes: 8 additions & 0 deletions src/Element/WebformNominatim.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,14 @@ public static function nominatimFetchSubmit(
);
}
}
// Reset current selection, if any. That way we can deselect wrongly made options
// By researching.
$form_state->set($my_geosjonkey.'-table-option', NULL);
$userinput = $form_state->getUserInput();
// Only way to get that tableselect form to rebuild completely
unset($userinput[$top_element['#name']]['feature']['table']);
$form_state->setUserInput($userinput);

// Rebuild the form.
$form_state->setRebuild(TRUE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
'#id' => 'webform_output_' . $this_widget_id,
'#default_value' => $current_value['creation_method'],
];

// Because the actual form attaches via AJAX the library/form alter never triggers my friends.
$element['#attached']['library'][] = 'webform_strawberryfield/webform_strawberryfield.nodeactions.toggle';
return $element;
}

Expand Down

0 comments on commit 0c1926b

Please sign in to comment.