Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Sitegeist.PaperTiger? #34

Open
lorenzulrich opened this issue Jan 21, 2024 · 4 comments · May be fixed by #41
Open

Support for Sitegeist.PaperTiger? #34

lorenzulrich opened this issue Jan 21, 2024 · 4 comments · May be fixed by #41

Comments

@lorenzulrich
Copy link
Contributor

Sitegeist.PaperTiger is a both Node- and Fusion Form-based Form Builder, therefore IMO a de-facto successor of Neos.Form.Builder.

While its sibling extension Sitegeist.StoneTablet has some nice ideas (e.g. bundling all uploaded files and the Excel export to an archive), Wegmeister.DatabaseStorage has far more features, e.g. a view of all values in the backend and the possibility to delete data.

Connecting PaperTiger with DatabaseStorage is quite simple, however DatabaseStorage cannot handle file uploads from PaperTiger.

This raises the following questions to @Benjamin-K:

  • Should we add PaperTiger support for DatabaseStorage as far as this is possible without making it a dependency?
  • If not: Should we document steps to implement in the readme?
@Benjamin-K
Copy link
Member

Hi @lorenzulrich,
Thanks for bringing this up. I love how you add new useful additions.

I think, we can add support for PaperTiger without adding it as a required dependency. Creating the Action NodeType is done quickly. But we need to check, if we need to add some special handling to it (I don't think so, but I must confirm this first).

The other option would be a new package that is used to connect both other packages. But I think, that is not necessary and we only need to define some of the existing NodeTypes as abstract NodeTypes again.

@lorenzulrich
Copy link
Contributor Author

The configuration is easily done - apart from attachment handling which needs adjustments to the PHP code:

DatabaseStorage.Definition.fusion:

prototype(Sitegeist.PaperTiger:Action.DatabaseStorage.Definition) < prototype(Neos.Fusion:Component) {
    formIdentifier = ${q(node).property('formIdentifier')}

    renderer = Sitegeist.PaperTiger:Action {
        type = '\\Wegmeister\\DatabaseStorage\\FusionForm\\Runtime\\Action\\DatabaseStorageAction'
        options {
            identifier = ${props.formIdentifier}
            formValues = ${data}
        }
    }
}

DatabaseStorage.Preview.fusion:

prototype(Sitegeist.PaperTiger:Action.DatabaseStorage.Preview) < prototype(Neos.Fusion:Component) {
    formIdentifier = ${q(node).property('formIdentifier')}

    renderer = afx`
        <dl class="papertiger-action-email__list">
            <dt>Formularname</dt>
            <dd>{props.formIdentifier}</dd>
        </dl>
    `
}

DatabaseStorage.yaml:

Sitegeist.PaperTiger:Action.DatabaseStorage:
  superTypes:
    'Sitegeist.PaperTiger:Action': true
  ui:
    label: 'Datenbank-Speicher'
    icon: 'icon-database'
  properties:
    formIdentifier:
      type: string
      ui:
        label: 'Formularname'
        showInCreationDialog: true
        inspector:
          group: 'form'
        help:
          message: 'Wird im Modul Datenbank-Speicher verwendet.'
      validation:
        'Neos.Neos/Validation/NotEmptyValidator': []
        'Neos.Neos/Validation/StringLengthValidator':
          maximum: 255
        'Neos.Neos/Validation/RegularExpressionValidator':
          regularExpression: '/^[a-z0-9\-]+$/i'
          validationErrorMessage: 'Der Tabellen-Name darf nur aus Buchstaben, Zahlen und Bindestrich bestehen.'

But as you can see, we have Sitegeist.PaperTiger:Action as a superType here which will fail if PaperTiger isn't installed. Should we create a Webmeister.DatabaseStorage.PaperTigerAdaptor?

@Benjamin-K
Copy link
Member

As you can see in the NodeTypes.yaml, we already have other abstract nodetypes defined to prevent the nodetypes from throwing an error. We can simply add Sitegeist.PaperTiger:Action there, too.

The attachment handling is hard to handle in a separate package i think, so I'd prefer doing it that way. What do you think?

@lorenzulrich
Copy link
Contributor Author

Ah, this is nice!
I think it's best to create a PR with my current changes, then we can discuss/review.

@Benjamin-K Benjamin-K linked a pull request Nov 26, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants