diff --git a/Configuration/Development/Settings.yaml b/Configuration/Development/Settings.yaml index e99a425..0065214 100644 --- a/Configuration/Development/Settings.yaml +++ b/Configuration/Development/Settings.yaml @@ -3,8 +3,3 @@ PackageFactory: PropTypes: enable: true -Neos: - Neos: - fusion: - autoInclude: - 'PackageFactory.AtomicFusion.PropTypes': true diff --git a/Configuration/Settings.yaml b/Configuration/Settings.yaml index 7cba3e3..e3dbc41 100644 --- a/Configuration/Settings.yaml +++ b/Configuration/Settings.yaml @@ -7,3 +7,9 @@ Neos: Fusion: defaultContext: PropTypes: \PackageFactory\AtomicFusion\PropTypes\Eel\PropTypesHelper + + Neos: + Neos: + fusion: + autoInclude: + 'PackageFactory.AtomicFusion.PropTypes': true diff --git a/Resources/Private/Fusion/Root.fusion b/Resources/Private/Fusion/Root.fusion index 1da4ebe..aaabb25 100644 --- a/Resources/Private/Fusion/Root.fusion +++ b/Resources/Private/Fusion/Root.fusion @@ -1,4 +1,5 @@ // this is only included in dev context +// todo not anymore prototype(Neos.Fusion:Component) { @exceptionHandler = 'PackageFactory\\AtomicFusion\\PropTypes\\Error\\ExceptionHandler\\PropTypeExceptionHandler' } @@ -6,3 +7,25 @@ prototype(Neos.Fusion:Component) { prototype(PackageFactory.AtomicFusion:Component) { @exceptionHandler = 'PackageFactory\\AtomicFusion\\PropTypes\\Error\\ExceptionHandler\\PropTypeExceptionHandler' } + +prototype(PackageFactory.AtomicFusion.PropTypes:PropsFromComponent) < prototype(Neos.Fusion:Value) { + type = null + isRequired = false + + @context.type = ${this.type} + value = Neos.Fusion:Renderer { + renderPath = ${'/<' + type + '>/__meta/propTypes'} + @process.propsArrayToPropTypes = ${PropTypes.dataStructure(value)} + } + + @process.makeRequired = ${this.isRequired ? value.isRequired : value} + @process.makeRequired.@position = "end" + +} + +prototype(PackageFactory.AtomicFusion.PropTypes:ArrayOfPropsFromComponent) < prototype(PackageFactory.AtomicFusion.PropTypes:ForComponent) { + type = null + isRequired = false + + @process.makeArrayOf = ${PropTypes.arrayOf(value)} +}