Skip to content

Feature/move digital signature configuration to handler - #349

Open
jekuaitk wants to merge 7 commits into
OS2Forms:developfrom
itk-dev:feature/move-digital-signature-configuration-to-handler
Open

jekuaitk wants to merge 7 commits into
OS2Forms:developfrom
itk-dev:feature/move-digital-signature-configuration-to-handler

Conversation

@jekuaitk

@jekuaitk jekuaitk commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Solves #348

  • Moves configuration to the handler instead of being on the element.

@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.

good job!

commented on the few things i could dig

break;
}
}
}

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.

according to this code, we allow multiple handlers of type os2forms_digital_signature , however if multiple of them are referencing to the same element, it will always be a first handler that gets processed.

Not a bug/issue, but something to be aware about

// and render the validation text consistently.
$elementKey = $element['#webform_key'] ?? NULL;
if ($elementKey !== NULL) {
foreach ($webform_submission->getWebform()->getHandlers('os2forms_digital_signature') as $handler) {

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.

This only checks whether the handler is globally enabled, but Webform also skips handlers whose per-submission conditions do not match. In that case preSave() does not sign the document, while this code still sets #digital_signature = TRUE and generates an unsigned PDF containing signature-validation text. Please also check $handler->checkConditions($webform_submission) here.

suggestion how to change it:

$handler->isEnabled()
  && $handler->checkConditions($webform_submission)
  && ($settings['attachment_element'] ?? '') === $elementKey

return [];
}

$elements = $webform->getElementsInitializedAndFlattened();

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.

os2forms_attachment also supports export_type: html, but all such elements are currently added to the selector.
Selecting one makes preSave() write HTML content to a .pdf file and send it to the signing service as a PDF. Please filter these options to #export_type === 'pdf' and add equivalent runtime validation.

@ds-bellcom

Copy link
Copy Markdown
Contributor

Please wait to merge this PR until the Drupal 11 release is out.

@ds-bellcom

Copy link
Copy Markdown
Contributor

@jekuaitk this PR may be merged to develop-branch when the corrections is made.

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.

Move digital signature configuration to the handler

3 participants