@@ -806,7 +806,60 @@ function civictheme_post_update_update_view_mode_civictheme_navigation_card_ref_
806806 if ($ config_read ) {
807807 $ config_object = \Drupal::configFactory ()->getEditable ('core.entity_view_display.paragraph.civictheme_navigation_card_ref.default ' );
808808 $ config_object ->set ('content.field_c_p_reference.settings.view_mode ' , 'civictheme_navigation_card ' );
809- $ config_object ->save ();return (string ) new TranslatableMarkup ('Updated view mode from "civictheme_snippet" to "civictheme_navigation_card". ' );
809+ $ config_object ->save ();
810+ return (string ) new TranslatableMarkup ('Updated view mode from "civictheme_snippet" to "civictheme_navigation_card". ' );
810811 }
811812 return (string ) new TranslatableMarkup ('No update needed for view mode. ' );
812813}
814+
815+ /**
816+ * Add field_c_b_link_in_mobile_menu field config and update form view.
817+ *
818+ * @SuppressWarnings(PHPMD.StaticAccess)
819+ */
820+ function civictheme_post_update_add_search_link_field_to_search_component (): string {
821+ $ block_field_configs = [
822+ 'field.storage.block_content.field_c_b_link_in_mobile_menu ' => 'field_storage_config ' ,
823+ 'field.field.block_content.civictheme_search.field_c_b_link_in_mobile_menu ' => 'field_config ' ,
824+ ];
825+
826+ $ config_path = \Drupal::service ('extension.list.theme ' )->getPath ('civictheme ' ) . '/config/install ' ;
827+ \Drupal::classResolver (CivicthemeUpdateHelper::class)->createConfigs ($ block_field_configs , $ config_path );
828+
829+ $ new_form_config = [
830+ 'field_c_b_link_in_mobile_menu ' => [
831+ 'type ' => 'boolean_checkbox ' ,
832+ 'weight ' => 2 ,
833+ 'region ' => 'content ' ,
834+ 'settings ' => [
835+ 'display_label ' => TRUE ,
836+ ],
837+ ],
838+ ];
839+
840+ \Drupal::classResolver (CivicthemeUpdateHelper::class)->updateFormDisplayConfig ('block_content ' , 'civictheme_search ' , $ new_form_config );
841+
842+ return (string ) new TranslatableMarkup ('Added field_c_b_link_in_mobile_menu field config and updated form view. ' );
843+ }
844+
845+ /**
846+ * Update editor config for D11 requirement (remove duplicate settings).
847+ */
848+ function civictheme_post_update_update_editor_allowed_field (): string {
849+ $ config_name = 'editor.editor.civictheme_rich_text ' ;
850+ $ config_object = \Drupal::configFactory ()->getEditable ($ config_name );
851+
852+ // Fetch the existing allowed tags.
853+ $ allowed_tags = $ config_object ->get ('settings.plugins.ckeditor5_sourceEditing.allowed_tags ' );
854+ if (is_array ($ allowed_tags )) {
855+ $ allowed_tags = array_filter ($ allowed_tags , function ($ tag ) {
856+ return $ tag !== '<a hreflang target title class="ct-content-link ct-content-link--external ct-button--button ct-theme-dark"> ' ;
857+ });
858+ $ config_object ->set ('settings.plugins.ckeditor5_sourceEditing.allowed_tags ' , $ allowed_tags );
859+
860+ // Update the configuration with the modified allowed tags.
861+ $ config_object ->save ();
862+ return (string ) new TranslatableMarkup ('Updated editor allowed field. ' );
863+ }
864+ return (string ) new TranslatableMarkup ('Allowed tags setting not set, aborting update. ' );
865+ }
0 commit comments