os2forms / os2forms_f2
OS2Forms: F2 integration
Requires
- php: ^8.4
- drush/drush: ^13.8
- itk-dev/drupal_psr6_cache: ^1.1
- itk-dev/f2-api-client: ^1.0
- os2forms/os2forms: ^6.1
Requires (Dev)
- drupal/coder: ^9.0
- ergebnis/composer-normalize: ^2.54
- itk-dev/drupal_translation_extractor: ^2.0
- mglaman/composer-drupal-lenient: ^1.0
- mglaman/phpstan-drupal: ^2.2
- palantirnet/drupal-rector: ^1.1
- php-vcr/php-vcr: ^1.12
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: 2.3.3
- phpstan/phpstan-deprecation-rules: ^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-09 22:15:22 UTC
README
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.
Installation
-
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 --help
for some help and examples on how to use the command.
Usage
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).
Examples
Install the F2 form examples module (drush pm:install os2forms_f2_examples) to load an example webform with F2
handlers.
Development
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 --update
We 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:start
Run task to see other useful development tasks.
Translations
Run
task translations:extract
to 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:restore
to discard any non-essential changes to translation files (e.g. timestamps being updated without any actual translation changes).
Testing
task drupal:site:install
User manual
The 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:site:install --yes task playwright:install --yes task user-manual:images:generate
Tip
If something fails, run
open tests/Playwright/playwright-report/index.html
to 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:generate
to quickly check that everything works as expected, but before committing anything you must run
task drupal:site:reset --yes task user-manual:images:generate
to reset Drupal before generating the images.
Tip
See Run a Playwright command for other cool tricks supported by DDEV and the Playwright add-on.
We use php-vcr to record and replay interactions with the F2 API during testing
and store cassettes in tests/vcr-cassettes.
Note
php-vcr has some redaction issues (cf. php-vcr/php-vcr#503) so we're not yet ready to publish cassettes and Git ignore the cassettes for now.
ddev dotenv set .env.local --os2forms-f2-test=value