curl -sSfA '' -o LICENSE.txt --compressed https://interoperable-europe.ec.europa.eu/sites/default/files/custom-page/attachment/2020-03/EUPL-1.2%20EN.txt |
||
|---|---|---|
| code | ||
| config | ||
| theme | ||
| LICENSE.txt | ||
| README.md | ||
Beslisboom (Decision Tree) — source delivery
This bundle contains the source code and configuration of the decision tree ("beslisboom") feature of the Forum Standaardisatie website. It is provided as a source delivery only — it is not a runnable/deployable package and is not expected to run standalone.
What the decision tree is
A decision_tree node whose content is a nested tree of paragraphs:
node: decision_tree
└─ field_decisiontree_pages → paragraph: decision_tree_page
├─ field_title / field_introduction
└─ field_question_groups → paragraph: decision_tree_question_group
└─ field_questions → paragraph: decision_tree_question
├─ field_question / field_question_type / field_tooltip
└─ field_answers → paragraph: decision_tree_answer
├─ field_answer / field_explanation
└─ field_standards (→ standaarden nodes)
There is also a parallel "specific" QA set and a step-based variant
(decision_tree_specific_*, decision_tree_step).
The paragraph tree is flattened to JSON server-side, cached on the node
(field_json), and rendered on the front-end by a React app.
Folder layout
code/— custom PHP/JS modulesdecision_tree_json/— walks the paragraph tree and produces the JSON (ParseController::parseNode) exposed at/node/{node}/json.bfs_react/— the React front-end (public decision tree app only) plus theMailOverviewwebform handler and the decision-tree webform.bfs_decision_tree/— trimmed to public parts only (see note below).
config/— Drupal configuration (fromconfig/sync/): thedecision_treenode type, alldecision_tree_*paragraph types, their fields, form/view displays, jsonapi resource configs, and the shared field storages they use.theme/— the visual front-end parts from thebfstheme (Twig wrapper + SCSS).
Notes
-
Shared field storages are included (e.g.
field_standards,field_explanation,field_question,field_body…). These storages are also used by other paragraph/content types in the full site, so they are not exclusive to the beslisboom. -
Theme: only the decision-tree-specific Twig template and SCSS partials are included, not the whole
bfstheme. One relevant hook lives in the sharedbfs.themefile and is reproduced here for reference:// Implements hook_preprocess_node(). function bfs_preprocess_node(&$variables): void { $node = $variables['node']; if ($node->getType() == 'decision_tree') { $variables['uuid'] = $node->uuid(); $variables['base_url'] = $GLOBALS['base_url']; } // ... }The public React app is attached via
hook_entity_view()incode/bfs_react/bfs_react.module.