Skip to content

Commit

Permalink
updating locaitons and integration issues
Browse files Browse the repository at this point in the history
  • Loading branch information
iruzevic committed Dec 3, 2024
1 parent 89a4687 commit 14c84da
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/).

## [3.0.9]

### Changed

- `getBlockLocations` helper now supports `postType` param.

## [3.0.8]

### Added
Expand Down Expand Up @@ -260,6 +266,7 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a

- Initial production release.

[3.0.9]: https://github.com/infinum/eightshift-forms-utils/compare/3.0.8...3.0.9
[3.0.8]: https://github.com/infinum/eightshift-forms-utils/compare/3.0.7...3.0.8
[3.0.7]: https://github.com/infinum/eightshift-forms-utils/compare/3.0.6...3.0.7
[3.0.6]: https://github.com/infinum/eightshift-forms-utils/compare/3.0.5...3.0.6
Expand Down
14 changes: 12 additions & 2 deletions src/Helpers/UtilsGeneralHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -706,11 +706,21 @@ public static function canIntegrationUseSync(string $integrationName): bool
* Return all posts where form is assigned.
*
* @param string $formId Form Id.
* @param string $type Type of the form.
*
* @return array<int, mixed>
*/
public static function getBlockLocations(string $formId): array
public static function getBlockLocations(string $formId, string $type): array
{
switch ($type) {
case UtilsConfig::SLUG_RESULT_POST_TYPE:
$outputString = "%\"resultOutputPostId\":\"{$formId}\"%";
break;
default:
$outputString = "%\"formsFormPostId\":\"{$formId}\"%";
break;
}

global $wpdb;

$items = $wpdb->get_results( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
Expand All @@ -721,7 +731,7 @@ public static function getBlockLocations(string $formId): array
LIKE %s
AND (post_status='publish' OR post_status='draft')
",
"%\"formsFormPostId\":\"{$formId}\"%"
$outputString
)
);

Expand Down

0 comments on commit 14c84da

Please sign in to comment.