Skip to content

312: Added OS2Forms handler interface for validating handler configur… - #340

Merged
jekuaitk merged 6 commits into
OS2Forms:developfrom
itk-dev:feature/312-report-misconfigured-handlers
Nov 2, 2026
Merged

jekuaitk merged 6 commits into
OS2Forms:developfrom
itk-dev:feature/312-report-misconfigured-handlers

Conversation

@jekuaitk

@jekuaitk jekuaitk commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

…ations

https://leantime.itkdev.dk/#/tickets/showTicket/7971

#312

  • Added reporting of misconfigured webform handlers on the webform build
    and handlers pages, based on programmatically validating handler
    configuration forms.
  • Added empty options to the Digital Post handler element selects, so
    dangling element references no longer display as valid configuration.

Note

The failing check is unrelated to changes made in this PR and should be solved in a separate PR.

Example misconfigured handler messages

Screenshot 2026-07-16 at 11 32 00

@jekuaitk
jekuaitk force-pushed the feature/312-report-misconfigured-handlers branch 2 times, most recently from f2c7ff8 to dfb89e7 Compare July 13, 2026 14:02
@jekuaitk
jekuaitk force-pushed the feature/312-report-misconfigured-handlers branch from dfb89e7 to 902f14f Compare July 13, 2026 14:33
@jekuaitk
jekuaitk requested a review from cableman July 15, 2026 07:26
Comment thread CHANGELOG.md Resolved
@cableman
cableman self-requested a review July 16, 2026 08:25
@ds-bellcom ds-bellcom linked an issue Oct 6, 2026 that may be closed by this pull request

@stankut stankut left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, but few questions

*/
public function validateForm(array &$form, FormStateInterface $form_state) {
$subform_state = SubformState::createForSubform($form['settings'], $form, $form_state);
$this->handler->validateConfigurationForm($form, $subform_state);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we are working with $form['settings'], should we validate it instead of the entire form?
e.g.

$this->handler->validateConfigurationForm($form['settings'], $subform_state);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some handlers index specific values in the entire form, i.e. ScheduleEmailWebformHandler::validateConfigurationForm setting errors on $form['settings']['scheduled']['send'].

public function buildForm(array $form, FormStateInterface $form_state) {
// Build the handler configuration form the same way as
// \Drupal\webform\Form\WebformHandlerFormBase::form().
$form['settings'] = [];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drupal implementation of it looks like this https://git.drupalcode.org/project/webform/-/blob/HEAD/src/Form/WebformHandlerFormBase.php#L201-205:

$form['#parents'] = [];

$form['settings'] = [
  '#tree' => TRUE,
  '#parents' => ['settings'],
];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 146da06

@jekuaitk
jekuaitk merged commit 100e15f into OS2Forms:develop Nov 2, 2026
8 checks passed
@jekuaitk
jekuaitk deleted the feature/312-report-misconfigured-handlers branch November 2, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reporting misconfigured handlers

3 participants