From c3e6adb018e5bb525147a3bbb1d0a2ee22df097b Mon Sep 17 00:00:00 2001 From: rdrew Date: Fri, 30 May 2025 12:34:32 -0300 Subject: [PATCH] svg in prepro --- olivesdocs.theme | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/olivesdocs.theme b/olivesdocs.theme index f9ace9a..ff28324 100755 --- a/olivesdocs.theme +++ b/olivesdocs.theme @@ -698,33 +698,17 @@ function _olivesdocs_hex_to_hsl(string $hex_string) { return [$h, $s, $l]; } -/* -function olivesdocs_preprocess_mirador(&$variables) { - $block = \Drupal::service('plugin.manager.block')->createInstance($viewer . 'mirador_block', [ - 'iiif_manifest_url' => "/node/$manifest_nid/manifest-single", - 'thumbnail_navigation_position' => 'hidden', - 'window_config' => [ - 'allowClose' => FALSE, - 'allowMaximize' => FALSE, - 'allowTopMenuButton' => FALSE, - 'allowWindowSideBar' => FALSE, - 'hideWindowTitle' => TRUE, - 'panels' => [ - 'info' => FALSE, - 'attribution' => FALSE, - ' canvas' => FALSE, - 'annotations' => FALSE, - 'search' => FALSE, - ], - ], - 'workspace_config' => [ - 'allowNewWindows' => FALSE, - 'isWorkspaceAddVisible' => FALSE, - 'workspaceControlPanel' => [ - 'enable' => FALSE, - ], - ], - ]); +function mytheme_preprocess_field(&$variables, $hook) { + // Check if this is the title field for the landing_page content type. + if ($variables['element']['#field_name'] == 'title' && $variables['element']['#bundle'] == 'landing_page') { + // Define the SVG code. + $svg_code = ''; + + // Add the SVG code as a Twig variable. + $variables['svg_image'] = [ + '#markup' => $svg_code, + '#allowed_tags' => ['svg', 'path'], + ]; + } } - */