Chris@0: bundle()); Chris@0: } Chris@0: } Chris@0: Chris@0: /** Chris@0: * Implements hook_theme_suggestions_HOOK_alter() for form templates. Chris@0: */ Chris@0: function umami_theme_suggestions_block_alter(array &$suggestions, array $variables) { Chris@0: // Block suggestions for custom block bundles. Chris@0: if (isset($variables['elements']['content']['#block_content'])) { Chris@0: array_splice($suggestions, 1, 0, 'block__bundle__' . $variables['elements']['content']['#block_content']->bundle()); Chris@0: } Chris@0: } Chris@0: Chris@0: /** Chris@0: * Implements hook_preprocess_breadcrumb(). Chris@0: */ Chris@0: function umami_preprocess_breadcrumb(&$variables) { Chris@0: // We are creating a variable for the Current Page Title, to allow us to print Chris@0: // it after the breadcrumbs loop has run. Chris@5: $route_match = \Drupal::routeMatch(); Chris@5: // Search page titles aren't resolved using the title_resolver service - it Chris@5: // will always return 'Search' instead of 'Search for [term]', which would Chris@5: // give us a breadcrumb of Home >> Search >> Search. Chris@5: // @todo Revisit after https://www.drupal.org/project/drupal/issues/2359901 Chris@5: // @todo Revisit after https://www.drupal.org/project/drupal/issues/2403359 Chris@5: $entity = $route_match->getParameter('entity'); Chris@5: if ($entity instanceof SearchPageInterface) { Chris@5: $variables['current_page_title'] = $entity->getPlugin()->suggestedTitle(); Chris@5: } Chris@5: else { Chris@5: $variables['current_page_title'] = \Drupal::service('title_resolver')->getTitle(\Drupal::request(), $route_match->getRouteObject()); Chris@0: } Chris@0: // Since we are printing the 'Current Page Title', add the URL cache context. Chris@0: // If we don't, then we might end up with something like Chris@0: // "Home > Articles" on the Recipes page, which should read "Home > Recipes". Chris@0: $variables['#cache']['contexts'][] = 'url'; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Implements hook_form_FORM_ID_alter(). Chris@0: */ Chris@0: function umami_form_search_block_form_alter(&$form, FormStateInterface $form_state) { Chris@0: $form['keys']['#attributes']['placeholder'] = t('Search by keyword, ingredient, dish'); Chris@0: }