This module add a F2 webform handler that can archive content from a OS2Forms Attachment webform element in F2.
The handler can achive on a case and on a matter. Documents in F2 can only be attached to matters, so when archiving on a case, the handler first creates a matter before attaching a document to it.
-
Install the module
drush pm:install os2forms_f2
-
Go to
/admin/os2forms_f2/settingsand define settings for connecting to the F2 API
Tip
Use the os2forms-f2:api-client Drush command to check that the API connection works as expected. Run
drush os2forms-f2:api-client --helpfor some help and examples on how to use the command.
When the F2 module has been installed and configured, an F2 handler can be added to a webform.
See the user manual for administrators and for form builders for more details on how to use the handler (both are in Danish).
Install the F2 form examples module (drush pm:install os2forms_f2_examples) to load an example webform with F2
handlers.
Important
2026-10-30: We lock phpstan/phpstan to version 2.3.3 as a temporary workaround for the issue reported in
rectorphp/rector#9947.
We use palantirnet/drupal-rector to run
Rector. drupal-rector pulls in rectorphp/rector, but conflicts with
"rector/rector": ">=2.6.2"
and therefore we cannot (yet) upgrade to rector/rector:^2.8.3.
See rectorphp/rector#9947 (comment) for details.
We use DDEV Drupal Contrib for development.
Details on the DDEV setup
The DDEV environment has been created by following the template on https://github.com/ddev/ddev-drupal-contrib#install:
ddev config --project-type=drupal11 --docroot=web
ddev add-on get ddev/ddev-drupal-contrib
ddev add-on get julienloizelet/ddev-playwright
ddev start
ddev poser --no-interaction
ddev symlink-project
# Detect expected Drupal and PHP versions.
ddev config --updateWe have a dependency on OS2Forms which requires Drupal
Lenient to install some outdated modules, and therefore we use a
DDEV hook to make sure that Drupal Lenient is installed
before we run any actual composer install commands:
# .ddev/config.yaml
hooks:
post-start:
# Install Drupal Lenient (https://github.com/mglaman/composer-drupal-lenient)
- exec: COMPOSER=composer.lenient.json composer init --no-interaction
- exec: COMPOSER=composer.lenient.json composer config --no-plugins allow-plugins.mglaman/composer-drupal-lenient true
- exec: COMPOSER=composer.lenient.json composer require mglaman/composer-drupal-lenient:^1.0
- exec: rm -f composer.lenient.*Start the show by running
task ddev:startRun task to see other useful development tasks.
Run
task translations:extractto extract translations.
Poedit (or similar tools) can be used to edit the generated po files.
Important
After editing a po file, you should run task translations:extract to format the translation file as the
translation extractor does it.
Run
task translations:git:restoreto discard any non-essential changes to translation files (e.g. timestamps being updated without any actual translation changes).
task drupal:os2forms:installThe Danish user manual for the F2 module sits in docs/user-manual/da/.
We use Playwright to generate images for the user manual – and perform some testing along the way – and we use ddev-playwright to run Playwright in the DDEV environment.
Before generating the images a
little setup must be added in tests/Playwright/.env.local:
# Settings used to connect to a real F2 API
F2_API_URI=
F2_API_USERNAME=
F2_API_SECRET=
F2_API_F2_USERNAME=
# An exiting case identifier
F2_CASE_IDENTIFIER=
# An exiting matter identifier
F2_MATTER_IDENTIFIER='903'With these in place, we can now generate images:
task drupal:os2forms:install --yes
task playwright:install --yes
task user-manual:images:generateTip
If something fails, run
open tests/Playwright/playwright-report/index.htmlto see an error report.
When editing the user manual and fooling around with Playwright to generate useful images, you can run
task user-manual:images:generateto quickly check that everything works as expected, but before committing anything you must run
task drupal:os2forms:install --yes
task user-manual:images:generatereset Drupal before generating the images.
Tip
See Run a Playwright command for other cool tricks supported by DDEV and the Playwright add-on.