8 – Can’t render webform submissions programmatically

I am creating a custom module and try to render a webform submissions data in custom function. when I try to call my custom function it’s giving me error like “The website encountered an unexpected error. Please try again later.

TypeError: Argument 1 passed to
DrupalCoreRoutingCurrentRouteMatch::getRouteMatch() must be an
instance of SymfonyComponentHttpFoundationRequest, null given,
called in
D:xampphtdocsxxxxappcorelibDrupalCoreRoutingCurrentRouteMatch.php
on line 87 in DrupalCoreRoutingCurrentRouteMatch->getRouteMatch()
(line 99 of corelibDrupalCoreRoutingCurrentRouteMatch.php).”

/**
 * Fetch submission.
 */
function get_subscribers() {
 $webform = DrupalwebformEntityWebform::load('webform_6406');
if ($webform->hasSubmissions()) {
  $query = Drupal::entityQuery('webform_submission')
    ->condition('webform_id', 'webform_6406');
  $result = $query->execute();
  $submission_data = ();
  foreach ($result as $item) {
    $submission = DrupalwebformEntityWebformSubmission::load($item);
    $submission_data() = $submission->getData();
  }
 }
 print_r($submission_data);
 return $submission_data;
}

get_subscribers();

Webform submissions using JSON:API POST method

I would like post submissions in webform using core’s JSON:API. I’ve created a webform, then added the fields I need. I’ve installed JSON:API Extras to be able customize some API properties per resource. I’m able to create submissions, override the remote address, post the referenced entity except to the field values.

I’ve also tried a couple of data formats, but still no luck.

Here’s what I’ve done so far.

Headers

  • api-key: 4bxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  • Content-Type: application/vnd.api+json
  • Accept: application/vnd.api+json

POST URL

http://example.com.com/api/webform_submission/contact

POST data

{
    "data": {
        "type": "webform_submission--contact",
        "attributes": {
            "entity_type": "node",
            "entity_id": "5",
            "remote_addr": "",

            // Format 1
            "email": "example@example.com",
            "name": [{"value": "Loremipsum"}],

            // Format 2
            "data": [{
                "email": "example@example.com",
                "message": ["Please ignore this email."],
                "name": [{"value": "Loremipsum"}],
                "subject": "Testing contact webform"
            }],
            
            // Format 3
            "data": [{
                "email": "example@example.com",
                "message": "Please ignore this email.",
                "name": "Loremipsum",
                "subject": "Testing contact webform"
            }]
        }
    }
}

Results

{
    "jsonapi": {
        "version": "1.0",
        "meta": {
            "links": {
                "self": {
                    "href": "http://jsonapi.org/format/1.0/"
                }
            }
        }
    },
    "data": {
        "type": "webform_submission--contact",
        "id": "035de1b3-01ef-49a9-89ab-3bf8b2b641ea",
        "links": {
            "self": {
                "href": "http://example.com.com/api/webform_submission/contact/035de1b3-01ef-49a9-89ab-3bf8b2b641ea"
            }
        },
        "attributes": {
            "serial": 211,
            "drupal_internal__sid": 62,
            "token": "xjIywCTtW9gqpgnYIAtVIIO_LpUB7pKIKnYfjIf1Z8U",
            "uri": "/api/webform_submission/contact",
            "created": "2020-11-05T01:26:51+00:00",
            "completed": "2020-11-05T01:26:51+00:00",
            "changed": "2020-11-05T01:26:51+00:00",
            "in_draft": false,
            "current_page": null,
            "remote_addr": null,
            "langcode": "en",
            "entity_type": "node",
            "entity_id": "5",
            "locked": false,
            "sticky": false,
            "notes": null
        },
        "relationships": {
            "uid": {
                "data": null,
                "links": {
                    "self": {
                        "href": "http://example.com.com/api/webform_submission/contact/035de1b3-01ef-49a9-89ab-3bf8b2b641ea/relationships/uid"
                    }
                }
            },
            "webform_id": {
                "data": null,
                "links": {
                    "self": {
                        "href": "http://example.com.com/api/webform_submission/contact/035de1b3-01ef-49a9-89ab-3bf8b2b641ea/relationships/webform_id"
                    }
                }
            }
        }
    },
    "links": {
        "self": {
            "href": "http://example.com.com/api/webform_submission/contact"
        }
    }
}

Drupal version: 9.x

Webform version: 6.0.0-alpha20

JSON:API Extras version: 8.x-3.16

Am I missing something?

8 – How do I prevent anonymous users from modifying and deleting their submissions after a webform closes?

I’m using Drupal 8.9.6 and Webform 5.20

Background

I have an event that lasts 7 days and I’ve created a registration webform (using Webform Nodes) for each day. Each webform gives anonymous users the permission to create, view, edit and delete their own submissions. These permissions are set on a per-webform basis and not globally. They are scheduled to open and close at given dates/times (the dates/times are set on the webform node edit form).

Problem

Anonymous users are able to edit and delete their submissions after the webform has closed.

Is this the expected behavior? If so, how can I prevent this?

I will do 100 USA citations and directory submissions backlink with high DA PA site for $15

I will do 100 USA citations and directory submissions backlink with high DA PA site

hello there
Welcome to seo_expert75
I will provide you High quality 300 USA citations directory submission backlink list with high DA PA.

If you want, Rank your Business or Website in google top you mast be needed directory submission. It is one of the most important in google ranking factors. It is included in Off-page SEO. I can do it very easily because I have lot of HQ directory sites and more experience.
Also, I can give you Edu backlinks, Profail creation backlinks, Social bookmarking, Web 2.0, Article submission, guest post, etc.( I am doing professionally website SEO in google top )

Note: It’s not a job for me, it’s my hobby. My good luck is that My hobby is my profession. I am here in long and full time.

✦Fast delivery with full satisfaction.

✦Manually created backlinks

✦White hat and 100% manual work

✦Manually rank up your website.

✦High-Quality backlinks

✦Full work report in MS Exel sheet

✦Verification and Trust backlinks

✦Delivery on time in promised

✦Lifetime free support

If you have any questions please feel free to contact me. I will be happy to answer your query.
Have a wonderful day and feel the breeze.

.(tagsToTranslate)directory(t)directorysubmiss(t)usadirectory(t)offpageseo(t)locallisting(t)localseo

I will do 500 high web directory submissions for $5

I will do 500 high web directory submissions

➨Qualityover Quantity

➨Alwaysover Deliver

➨300 Verified Links from unique domain

➨MultipleURL Allowed w/ specific titles.

➨Randomuser name for less footprints

➨Privateproxies used for less footprints

➨Suggestedas Tier-2

➨SpintaxAccepted in title,desc.

➨RSS+ Ping

➨Detailedexcel report contains Exact URLs.

➨All directory live links submitted to Premium Indexer

.

Community of the Month #40 – Submissions | Forum Promotion


Contest Information

Community of the Month is a monthly contest where members can vote on whose website or forum most deserves recognition. This contest merges two contests which we have previously held into a single contest, bringing a new take on this classic staple of Forum Promotion.

Typically, forums/sites are submitted from the 1st to the 15th, and voted on between the 16th and the 31st.

Submission Rules

  • You must have 15 posts on Forum Promotion to submit a site.
  • For a site to be accepted, its owner (or an administrator) must be a member of the Forum Promotion community.
  • You are allowed to submit as many sites or forums you want per month, so long as you are said owner or administrator of the site or forum.
  • All sites submitted must follow FP’s acceptable content policy.
  • We reserve the right to accept or decline any site submitted to CoTM.
  • When a site wins CoTM, it cannot be submitted again for another two months.

Contest Prizes

  • Advertisements: The winning site will be featured on the Community Billboard for one month.
  • Sticky: Your Promotion Directory topic will be stickied for one month.
  • Recognition: A medal will be displayed on each post you make on FP for one month.
  • Free Service: You will receive one free service of your choice on FP.

Submit Your Forum, Blog, or Website

We are currently accepting submissions until 11:59 PM EST on the 15th of July 2020. To submit your community to this contest, please post the following form as a reply to this topic.