From bdabed67b19d4db6a1ca30aa9eb7350e21e20f23 Mon Sep 17 00:00:00 2001 From: Md Nadim Hossain Date: Mon, 16 Dec 2024 18:51:57 +1100 Subject: [PATCH 1/2] Updated otp email template for tfa. --- modules/tide_tfa/src/TideTfaOperation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/tide_tfa/src/TideTfaOperation.php b/modules/tide_tfa/src/TideTfaOperation.php index 31da5928..d9b329b6 100644 --- a/modules/tide_tfa/src/TideTfaOperation.php +++ b/modules/tide_tfa/src/TideTfaOperation.php @@ -103,7 +103,7 @@ public static function setupTfaSettings() { 'code_validity_period' => '600', 'email_setting' => [ 'subject' => 'Single Digtial Presence CMS two-factor authentication code', - 'body' => '[user:display-name],\r\n\r\nThis code is valid for [length] minutes. \r\n\r\nYour code is: [code]\r\n\r\nThis code will expire once you have logged in.', + 'body' => 'Hi [user:display-name],\r\n\r\nYour two-factor authentication code is: [code]\r\n\r\nThis code is valid for [length] minutes. \r\n\r\nThis code will expire when you have logged in.\r\n\r\nFrom the SDP team\r\n\r\nRead more about 2FA: https://digital-vic.atlassian.net/servicedesk/customer/article/2439479507', ], ], ]; From c4c0ddd9a2554e41ee7006add70b6ccfba4a13d5 Mon Sep 17 00:00:00 2001 From: Md Nadim Hossain Date: Tue, 17 Dec 2024 09:28:10 +1100 Subject: [PATCH 2/2] [SD-563] Added hook to roll out tide_data_driven_component for all cms. (#564) * [SD-563] Added hook to roll out tide_data_driven_component for all cms. and add the component to header and landing page component. --- tide_core.install | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tide_core.install b/tide_core.install index a6000519..79171eb9 100644 --- a/tide_core.install +++ b/tide_core.install @@ -5,6 +5,7 @@ * Installation functions for Tide Core. */ +use Drupal\field\Entity\FieldConfig; use Drupal\tide_core\TideCoreOperation; use Drupal\user\Entity\Role; use Drupal\user\Entity\User; @@ -316,3 +317,44 @@ function tide_core_update_10010() { $module_installer->install(['tide_tfa']); } } + +/** + * Enabled tide_data_driven_component module. + */ +function tide_core_update_10011() { + $moduleHandler = \Drupal::service('module_handler'); + $moduleInstaller = \Drupal::service('module_installer'); + // Enable tide_data_driven_component. + if (!$moduleHandler->moduleExists('tide_data_driven_component')) { + $moduleInstaller->install(['tide_data_driven_component']); + } + if ($moduleHandler->moduleExists('tide_landing_page')) { + // Define the fields to be updated. + $fields_to_update = [ + 'field_landing_page_component', + 'field_landing_page_header', + ]; + $new_component = 'data_driven_component'; + + foreach ($fields_to_update as $field_name) { + $field_config = FieldConfig::loadByName('node', 'landing_page', $field_name); + + if ($field_config) { + // Get the current handler settings. + $handler_settings = $field_config->getSetting('handler_settings'); + + // Ensure 'target_bundles' exists in handler settings. + if (isset($handler_settings['target_bundles'])) { + // Add the new component if it does not already exist. + if (!array_key_exists($new_component, $handler_settings['target_bundles'])) { + $handler_settings['target_bundles'][$new_component] = $new_component; + + // Update the field configuration with the new handler settings. + $field_config->setSetting('handler_settings', $handler_settings); + $field_config->save(); + } + } + } + } + } +}