Skip to content

Commit 8648be9

Browse files
committed
refactor: elementor controller
1 parent e5e9f01 commit 8648be9

File tree

2 files changed

+3
-34
lines changed

2 files changed

+3
-34
lines changed

includes/Triggers/Elementor/ElementorController.php

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace BitCode\FI\Triggers\Elementor;
44

55
use BitCode\FI\Flow\Flow;
6-
use BitCode\FI\Triggers\TriggerController;
76

87
final class ElementorController
98
{
@@ -50,30 +49,20 @@ public static function pluginActive($option = null)
5049
return (bool) (is_plugin_active('elementor-pro/elementor-pro.php') || is_plugin_active('elementor/elementor.php'));
5150
}
5251

53-
public function getTestData()
54-
{
55-
return TriggerController::getTestData('elementor');
56-
}
57-
58-
public function removeTestData($data)
59-
{
60-
return TriggerController::removeTestData($data, 'elementor');
61-
}
62-
6352
public static function handle_elementor_submit($record)
6453
{
6554
$recordData = ElementorHelper::extractRecordData($record);
6655
$formData = ElementorHelper::setFields($recordData);
6756
$reOrganizeId = $recordData['id'] . $recordData['form_post_id'];
6857

69-
if (get_option('btcbi_elementor_test') !== false) {
70-
update_option('btcbi_elementor_test', [
58+
if (get_option('btcbi_elementor_pro/forms/new_record_test') !== false) {
59+
update_option('btcbi_elementor_pro/forms/new_record_test', [
7160
'formData' => $formData,
7261
'primaryKey' => [(object) ['key' => 'id', 'value' => $recordData['id']]]
7362
]);
7463
}
7564

76-
$flows = ElementorHelper::fetchFlows($recordData['id'], $reOrganizeId);
65+
$flows = Flow::exists('Elementor', ['elementor_pro/forms/new_record', $recordData['id'], $reOrganizeId]);
7766
if (!$flows) {
7867
return;
7968
}

includes/Triggers/Elementor/ElementorHelper.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,6 @@ public static function extractRecordData($record)
1717
];
1818
}
1919

20-
public static function fetchFlows($formId, $reOrganizeId)
21-
{
22-
global $wpdb;
23-
24-
return $wpdb->get_results(
25-
$wpdb->prepare(
26-
"SELECT * FROM {$wpdb->prefix}btcbi_flow
27-
WHERE status = true
28-
AND triggered_entity = %s
29-
AND (triggered_entity_id = %s
30-
OR triggered_entity_id = %s
31-
OR triggered_entity_id = %s)",
32-
'Elementor',
33-
'elementor_pro/forms/new_record',
34-
$formId,
35-
$reOrganizeId
36-
)
37-
);
38-
}
39-
4020
public static function isPrimaryKeysMatch($recordData, $flowDetails)
4121
{
4222
foreach ($flowDetails->primaryKey as $primaryKey) {

0 commit comments

Comments
 (0)