PluginProbe
The Innovative Form Builder – IvyForms / 1.4
The Innovative Form Builder – IvyForms v1.4
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / backend / src / Services / GoogleSheets / Hooks / SettingsHook.php

SettingsHook.php in The Innovative Form Builder – IvyForms 1.4, at backend/src/Services/GoogleSheets/Hooks/SettingsHook.php

36 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace IvyForms\Services\GoogleSheets\Hooks;
4
5 /**
6 * Injects Google Sheets integration data into the global settings API response.
7 */
8 class SettingsHook
9 {
10 /**
11 * @param array<string, mixed> $organizedSettings
12 * @param array<string, mixed> $allSettings
13 * @return array<string, mixed>
14 */
15 public function addIntegrationData(array $organizedSettings, array $allSettings): array
16 {
17 $googleSheetsSettings = $allSettings['integrations']['google_sheets'] ?? null;
18
19 if (!is_array($googleSheetsSettings)) {
20 $organizedSettings['integrations']['google_sheets'] = [
21 'enabled' => false,
22 'connected' => false,
23 ];
24
25 return $organizedSettings;
26 }
27
28 $organizedSettings['integrations']['google_sheets'] = [
29 'enabled' => !empty($googleSheetsSettings['enabled']),
30 'connected' => !empty($googleSheetsSettings['refreshToken']),
31 ];
32
33 return $organizedSettings;
34 }
35 }
36