diff --git a/blocks/email/handler.php b/blocks/email/handler.php index e3c1fbc..d94a690 100644 --- a/blocks/email/handler.php +++ b/blocks/email/handler.php @@ -8,6 +8,15 @@ * @return array The prepared link data. */ function handleLinkType($request, $linkType) { + + $rules = [ + 'link' => [ + 'required', + 'string', + 'max:255', + ], + ]; + // Prepare the link data $linkData = [ 'title' => $request->title, @@ -15,5 +24,5 @@ function handleLinkType($request, $linkType) { 'link' => $request->link, ]; - return $linkData; + return ['rules' => $rules, 'linkData' => $linkData]; } \ No newline at end of file diff --git a/blocks/heading/handler.php b/blocks/heading/handler.php index ecfa2a0..97b6f6c 100644 --- a/blocks/heading/handler.php +++ b/blocks/heading/handler.php @@ -8,13 +8,20 @@ * @return array The prepared link data. */ function handleLinkType($request, $linkType) { + + $rules = [ + 'title' => [ + 'required', + 'string', + 'max:255', + ], + ]; + // Prepare the link data $linkData = [ 'title' => $request->title, 'button_id' => "42", - 'var1' => "1", - 'var2' => "1", ]; - return $linkData; + return ['rules' => $rules, 'linkData' => $linkData]; } \ No newline at end of file diff --git a/blocks/link/handler.php b/blocks/link/handler.php index 881b221..f3b13d1 100644 --- a/blocks/link/handler.php +++ b/blocks/link/handler.php @@ -9,6 +9,14 @@ */ function handleLinkType($request, $linkType) { + $rules = [ + 'title' => [ + 'required', + 'string', + 'max:255', + ], + ]; + if ($request->GetSiteIcon == "1") { $buttonID = "2"; } else { @@ -21,5 +29,5 @@ function handleLinkType($request, $linkType) { 'button_id' => $buttonID, ]; - return $linkData; + return ['rules' => $rules, 'linkData' => $linkData]; } \ No newline at end of file diff --git a/blocks/spacer/handler.php b/blocks/spacer/handler.php index b8e29aa..063ba4f 100644 --- a/blocks/spacer/handler.php +++ b/blocks/spacer/handler.php @@ -8,11 +8,19 @@ * @return array The prepared link data. */ function handleLinkType($request, $linkType) { + + $rules = [ + 'height' => [ + 'required', + 'max:255', + ], + ]; + // Prepare the link data $linkData = [ 'title' => $request->height ?? null, 'button_id' => "43", ]; - return $linkData; + return ['rules' => $rules, 'linkData' => $linkData]; } \ No newline at end of file diff --git a/blocks/telephone/handler.php b/blocks/telephone/handler.php index 4a8c416..d0030ba 100644 --- a/blocks/telephone/handler.php +++ b/blocks/telephone/handler.php @@ -8,11 +8,20 @@ * @return array The prepared link data. */ function handleLinkType($request, $linkType) { + + $rules = [ + 'link' => [ + 'required', + 'max:255', + ], + ]; + // Prepare the link data $linkData = [ 'title' => $request->title, 'button_id' => "44", + 'link' => $request->link, ]; - return $linkData; + return ['rules' => $rules, 'linkData' => $linkData]; } \ No newline at end of file diff --git a/blocks/text/handler.php b/blocks/text/handler.php index 73bf967..4d503c6 100644 --- a/blocks/text/handler.php +++ b/blocks/text/handler.php @@ -8,6 +8,15 @@ * @return array The prepared link data. */ function handleLinkType($request, $linkType) { + + $rules = [ + 'text' => [ + 'required', + 'string', + 'max:5000', + ], + ]; + // Sanitize the text input $sanitizedText = $request->text; $sanitizedText = strip_tags($sanitizedText, '