-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Description
The concept of blueprints expressed in the documentation seems very related to YAML inheritance, and most of BlueprintForm.php intents are related to this.
The form-plugin -> grav built-in blueprints -> toolbox form blueprints loading/importing, the closure magics and sparse documentation (aside from some phpdoc of little help) makes this part of the codebase huge, complex and really hard to understand.
I'm new to Grav codebase but I wonder whether YAML builtins would be a better fit
## pages/01.home/form.md
## Over-exagerated example
!include blueprint://my-form as my_form # using an alias notation
!include plugin://foo/common-rules.yml # or importing in a namespace derived from path
rules:
<<: *my_form.rules
<<: *plugins.foo.common_rules
form: *my_form.form## plugins/foo/common-rules.yml
common_rules:
blah: fooIf the main goal is to provide an easy YAML inheritance system, YAML already provides:
&anchor*reference<<: *merge<<: *merge{partial: key}- and the ability to preprocess custom tags, eg an
!includemacro directive
These provides a much more explicit and flexible way to define inheritance relationships inside YAML.
Some examples of YAML preprocessors:
- using PECL parser: http://php.net/manual/fr/yaml.callbacks.parse.php
- using python (but respectfully of YAML standard): https://stackoverflow.com/a/30665526/5441588
- or using symfony/twig TaggedValue as does symfony/dependency-injection
Metadata
Metadata
Assignees
Labels
No labels