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

Add support for the Webform module #334

Open
1 task
Tracked by #338 ...
Decipher opened this issue Oct 11, 2021 · 5 comments
Open
1 task
Tracked by #338 ...

Add support for the Webform module #334

Decipher opened this issue Oct 11, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@Decipher
Copy link
Member

Is your feature request related to a problem? Please describe.
As a user I want the ability to display forms build with the Webform module in Druxt

Describe the solution you'd like

  • Create a custom Webform module for Druxt

Describe alternatives you've considered
N/A

Additional context

@Decipher Decipher added the enhancement New feature or request label Oct 11, 2021
@davidferlay
Copy link

davidferlay commented Oct 11, 2021

FYI there is a json:api endpoint exposing webform configs :

  • curl --location --request GET 'http://172.19.0.4/jsonapi/webform/webform/'
  • it requires permission Access any webform configuration

There is also /jsonapi/webform_options/webform_options endpoint that provides the values of pre-defined select list webform elements (it's a distinct config item in webform module). Funny enough, it requires a different permission: Administer webform

image

@Decipher
Copy link
Member Author

Decipher commented Jan 4, 2022

Thanks for the additional information @davidferlay,

I did look into this atleast once, and did get a working prototype, but for whatever reason I didn't commit it.
I will revisit this in a future Druxt Office Hours

@Decipher
Copy link
Member Author

Decipher commented Jan 5, 2022

I've put together my initial prototype of Druxt with Webform: https://github.com/Decipher/druxt-experiments/tree/feature/webform

Gitpod: https://gitpod.io/#github.com/Decipher/druxt-experiments/tree/feature/webform

Currently it will render a Webform attached to a Webform node. As Webforms are content entities, it should also be possible to render a detached webform.

The Webform elements are parsed using js-yaml and the data is then fed into a custom DruxtWebformElements modules that renders the fields with support for DruxtWrapper components. E.g., DruxtWebformElementTextfield.

I haven't yet attempted to submit or handle the data, but I will followup when I continue with the experiment.

image

@davidferlay
Copy link

Sounds good @Decipher ! I'll have a deeper look at the code and gitpod soon

@davidferlay
Copy link

Looks good ! A shame that code is needed for every webform element though

Vue is throwing a minor error btw in gitpod btw
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants