Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
Change namespace to TideResource
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-gao committed Jun 5, 2023
1 parent d22cd41 commit 82fc80a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Drupal\tide_webform_jsonapi\Resource;
namespace Drupal\tide_webform_jsonapi\TideResource;

use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\jsonapi\JsonApiResource\ErrorCollection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function validatePayload(array $payload, array $massaged_validates_array,
}
// 3rd step, check if the field contains correct email or phone numbers.
foreach ($original_elements as $field_id => $detail) {
if (!isset($results[$field_id])) {
if (!isset($results[$field_id]) && isset($payload[$field_id])) {
if ($detail['#type'] === 'email') {
if (v::email()->validate($payload[$field_id]) === FALSE) {
$results[$field_id] = ['Please provide a valid email address.'];
Expand Down
2 changes: 1 addition & 1 deletion modules/tide_webform_jsonapi/tide_webform_jsonapi.info.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'JSON:API Tide_webform'
description: "This module let's you validate payload for webform."
core_version_requirement: ^9 || ^10
core_version_requirement: ^9.5 || ^10
type: module
dependencies:
- drupal:jsonapi_resources
4 changes: 2 additions & 2 deletions modules/tide_webform_jsonapi/tide_webform_jsonapi.routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ tide_webform_jsonapi.add_webform:
path: '/%jsonapi%/webform/{webform}/add'
methods: ['POST']
defaults:
_jsonapi_resource: Drupal\tide_webform_jsonapi\Resource\AddWebform
_jsonapi_resource: Drupal\tide_webform_jsonapi\TideResource\AddWebform
requirements:
_permission: 'access content'
options:
parameters:
webform:
type: 'entity:webform'
type: 'entity:webform'

0 comments on commit 82fc80a

Please sign in to comment.