Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
language: php

sudo: false

php:
- 7.2

install:
- composer global require drush/drush:8.x-dev drupal/coder mglaman/drupal-check friendsoftwig/twigcs
- export PATH="$HOME/.config/composer/vendor/bin:$PATH"
- phpcs --config-set installed_paths ../../drupal/coder/coder_sniffer
- phpenv rehash
- nvm install node
- nvm use node
- npm install --global yarn
- cd ../ && drush dl drupal-8 --drupal-project-rename=drupal
- cd drupal
- DRUPAL_ROOT=$(pwd)
- export REPOSITORIES='"repositories":\ \['
- export REPOSITORIES_REPLACE='"repositories":\[\{"type":"path","url":"..\/os2forms","options":\{"symlink":false\}\},'
- export REQUIRE='"require":\ {'
- export REQUIRE_REPLACE='"require":{"os2forms\/os2forms":"\*",'
- sed -i "s/$REPOSITORIES/$REPOSITORIES_REPLACE/g" composer.json
- sed -i "s/$REQUIRE/$REQUIRE_REPLACE/g" composer.json
- composer update
- PROJECT_PATH=$DRUPAL_ROOT/modules/contrib/os2forms
- cd $DRUPAL_ROOT/core
- yarn install
- npm install --global eslint-config-drupal-bundle stylelint

script:
- phpcs --standard=Drupal --ignore=*.md $PROJECT_PATH
- twigcs $PROJECT_PATH
- cd $DRUPAL_ROOT/core
- eslint $DRUPAL_ROOT/modules/contrib/os2forms
- stylelint --aei $DRUPAL_ROOT/modules/contrib/os2forms/**/*.css
- drupal-check $DRUPAL_ROOT/modules/contrib/os2forms
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# OS2Forms Drupal module [![Build Status](https://travis-ci.org/OS2Forms/os2forms.svg?branch=8.x)](https://travis-ci.org/OS2Forms/os2forms)

## Install

OS2Forms Drupal 8 module is available to download via composer.
```
composer require os2forms/os2forms
drush en os2forms
```

If you don't have Drupal installed on you server, you will to need install it first.
Read more about [how to install drupal core](https://www.drupal.org/docs/8/install).

We are recommending to install drupal via composer by using
[drupal-composer project](https://github.com/drupal-composer/drupal-project).

To get more benefits on your Drupal project we are offering you to use
[OS2web](https://packagist.org/packages/os2web/os2web) as installation
profile for Drupal.

You can easy download and install OS2web installation profile to your
composer based Drupal project with commands:
```
composer require os2web/os2web
drush si os2web --db-url=mysql://db_user:db_pass@mysql_host/db_name --account-pass=admin -y
```

## Update
Updating process for OS2forms module is similar to usual Drupal 8 module.
Use Composer's built-in command for listing packages that have updates available:

```
composer outdated os2forms/os2forms
```
## Automated testing and code quality
See [OS2Forms testing and CI information](https://github.com/OS2Forms/docs#testing-and-ci)

## Contribution

OS2Forms project is opened for new features and os course bugfixes.
If you have any suggestion or you found a bug in project, you are very welcome
to create an issue in github repository issue tracker.
For issue description there is expected that you will provide clear and
sufficient information about your feature request or bug report.

### Code review policy
See [OS2Forms code review policy](https://github.com/OS2Forms/docs#code-review)

### Git name convention
See [OS2Forms git name convention](https://github.com/OS2Forms/docs#git-guideline)

## Unstable features
### Export submissions to Word
This feature is still not part of Webform and Entity print modules stable versions
due to following issues:
* [[Webform] Unlock possibility of using Entity print module export to Word feature](https://www.drupal.org/project/webform/issues/3096552)
* [[Entity Print] Add Export to Word Support](https://www.drupal.org/project/entity_print/issues/2733781)

To get this functionality on drupal project there will be applied patches from issues above via Composer.

NOTE: If you are downloading os2forms module without using composer, be aware that you have apply those patches by yourself.
22 changes: 20 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Drupal 8 OS2Form module provides advanced webform functionality for Danish Municipalities",
"minimum-stability": "dev",
"prefer-stable": true,
"license": "GPL-2.0-or-later",
"license": "EUPL-1.2",
"repositories": {
"drupal": {
"type": "composer",
Expand All @@ -28,6 +28,24 @@
"drupal/entity_print": "^2.1",
"drupal/webform_migrate": "^1.1",
"drupal/maillog": "1.x-dev",
"drupal/devel": "^2.1"
"drupal/devel": "^2.1",
"phpoffice/phpword": "^0.17.0",
"tecnickcom/tcpdf": "~6",
"vaimo/composer-patches": "^4.20"
},
"extra" : {
"composer-exit-on-patch-failure": true,
"patchLevel": {
"test": "-p2"
},
"enable-patching" : true,
"patches": {
"drupal/entity_print": {
"2733781 - Add Export to Word Support": "https://www.drupal.org/files/issues/2019-11-22/2733781-47.patch"
},
"drupal/webform" : {
"3096552 - Unlock possibility of using Entity print module export to Word feature": "https://www.drupal.org/files/issues/2019-11-25/3096552-unlock-export-to-word-1.patch"
}
}
}
}
5 changes: 4 additions & 1 deletion os2forms.info.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: 'os2form'
name: 'OS2Forms'
type: module
description: 'Provides advanced webform functionality for Danish Municipalities.'
package: OS2
core: 8.x
core_version_requirement: ^8 || ^9

dependencies:
- webform
- webform_ui
- webform_access
- webform_attachment
- webform_entity_print
Expand Down
45 changes: 45 additions & 0 deletions os2forms.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

/**
* @file
* Install file for OS2Forms module.
*/

/**
* Implements hook_requirements().
*/
function os2forms_requirements($phase) {
$requirements = [];

$config = \Drupal::service('config.factory')->get('entity_print.settings');
$severity = REQUIREMENT_OK;
if (!empty($config) && \Drupal::moduleHandler()->moduleExists('webform_entity_print_attachment')) {
$messages = [
'#prefix' => t('Entity print configuration'),
'#theme' => 'item_list',
'#items' => [],
];
foreach (['pdf', 'word_docx'] as $type) {
$library = $config->get('print_engines.' . $type . '_engine');
if (empty($library)) {
$severity = REQUIREMENT_WARNING;
$library = t('<strong>EMPTY</strong>');
}
$messages['#items'][] = $library_status = t('Engine @type: @value', [
'@type' => $type,
'@value' => $library,
]);
}
$messages = \Drupal::service('renderer')->renderPlain($messages);
}
else {
$messages = t('Webform Entity Print Attachment module is not enabled');
$severity = REQUIREMENT_WARNING;
}
$requirements['os2forms'] = [
'title' => t('os2forms'),
'severity' => $severity,
'value' => $messages,
];
return $requirements;
}