From 0f4ca55ed7ba98405049c73416840a4157a7e4c7 Mon Sep 17 00:00:00 2001 From: lorenzulrich Date: Fri, 15 Dec 2023 20:58:41 +0100 Subject: [PATCH] TASK: Add example to Extensibility chapter Without looking at the code, it's nearly impossible to extend the package with a field. An example will help understanding how it actually works. --- README.md | 52 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 12c5ba4..58047fa 100644 --- a/README.md +++ b/README.md @@ -123,11 +123,57 @@ Packages can add additional fields to the forms of taxonomies and vocabularies. the following steps are required. 1. Extend the NodeTypes `Sitegeist.Taxonomy:Taxonomy` or `Sitegeist.Taxonomy:Vocabulary` in your package. -2. Add tha path to your additional `Root.fusion` to the Setting in path `Sitegeist.Taxonomy.backendModule.additionalFusionIncludePathes`. -3. In the fusion code define each field as prototype that accepts the props `name` plus `taxon` & `defaultTaxon` resp. `vocabulary` & `defaultVocabulary`. -4. Register addtional prototypesNames by adding them to the Settings `Sitegeist.Taxonomy.backendModule.additionalVocabularyFieldPrototypes` or + +```yaml +'Sitegeist.Taxonomy:Taxonomy': + properties: + uriPathSegment: + type: string +``` + +2. Add the path to your additional `Root.fusion` to the Setting in path `Sitegeist.Taxonomy.backendModule.additionalFusionIncludePathes`. + +```yaml +Sitegeist: + Taxonomy: + backendModule: + additionalFusionIncludePathes: + # Use anything but 0 as key + uriPathSegment: 'resource://FoobarCom.Site/Private/Fusion/Taxonomy/Property/UriPathSegment.fusion' +``` + +3. In the Fusion code, define each field as prototype that accepts the props `name` plus `taxonomy` & `defaultTaxonomy` resp. `vocabulary` & `defaultVocabulary`. + +``` +prototype(FoobarCom.Site:Taxonomy.Property.UriPathSegment) < prototype(Neos.Fusion:Component) { + name = '' + taxonomy = '' + defaultTaxonomy = null + + renderer = afx` +
+ + +
+ ` +} +``` + +4. Register additional prototype names by adding them to the Settings `Sitegeist.Taxonomy.backendModule.additionalVocabularyFieldPrototypes` or `Sitegeist.Taxonomy.backendModule.additionalTaxonomyFieldPrototypes` +```yaml +Sitegeist: + Taxonomy: + backendModule: + additionalTaxonomyFieldPrototypes: + # Use the property name as key + uriPathSegment: 'FoobarCom.Site:Taxonomy.Property.UriPathSegment' +``` + ## Contribution We will gladly accept contributions. Please send us pull requests.