govCMS / GovCMS8

Current stable release of the main GovCMS8 distribution.
GNU General Public License v2.0
61 stars 58 forks source link

Add Webform REST Webform REST to GovCMS8 #580

Open jozzhart opened 3 years ago

jozzhart commented 3 years ago

** What value does this module/package add to GovCMS?

Ability for SPAs to submit webforms.

** Please provide a brief outline of what this module does.

Provides REST service for webform module.

** Who does this module benefit: [x] end users [ ] content editors [ ] site builders [ ] themers [x] developers

** How could you provide/replicate the functionality of this module using alternative methods, eg in your theme?

I created a new content type 'webform proxy' and created a node, so that I had a URL to POST to, to programmatically create the webform submission.

function lifechecks_preprocess_node(&$variables) {

$nid = $variables['node']->id();

if($nid == '495' && $_SERVER['REQUEST_METHOD'] === 'POST') {

    $webform_id = \Drupal::request()->request->get('webform_id');
    $data = \Drupal::request()->request->get('data');
    $email = \Drupal::request()->request->get('email');

    $values = [
        'email' => $email,
        'data' => $data
    ];

    $submission = WebformSubmission::create(['webform_id' => $webform_id]); 
    $submission->setData($values);
    $submission->save();

    die;
}

}

** If this module styles or alters HTML or JavaScript output, can the functionality be provided via the theme? What alternatives have you considered.

N/A

** What is the maintenance and support status of the module. Describe the issue queue activity.

Actively supported.

All issues 13 open, 56 total Bug report 2 open, 20 total

New issues: 0 Response rate: 100% 1st response: 68 hours Open bugs: 2 Participants: 0

** What permissions are needed to utilise the module (and are any new permissions provided by the module)?

Not sure

** Does the module modify the database structure and/or store additional metadata on nodes or other entities? If so, why? What are the risks for future updates?

no

** Is the module designed to capture anonymous user data?

no

** Is the output of the module typically fully cacheable? Would the inclusion of this module potentially render pages uncacheable.

not sure

** What is your assessment of the quality of this module, the contribution history of the module's maintainers, and the uptake of the module within the Drupal community?

The three maintainers are all accomplished Drupal developers

** Additional information

Support ticket with history of attempt of trying to submit webform from SPA and GovCMS support recommendation to request this module.

https://www.govcms.support/support/tickets/8349

thisisalistairsaccount commented 3 years ago

The current challenge with this module (https://www.drupal.org/project/webform_views) is that it its currently in beta.

While it's good that it has D9 forward compatibility, we'd be really keen to see it hit stable before we could consider introducing something like this into the distribution or that it becomes part of the regular webform release.