1

I use panels to output my taxonomy term structure. So instead of having one static title for all taxonomies, I need the page title to be the "taxonomy_term_context:title".

In D7 there were modules. How to deal with dynamic title for panels in Drupal 8? Are there any hooks? The panels ui does not seem to handle title from context features.

Thanks

1

Couldn't find anything useful in the web. I have written a custom module with this hook:

/**
 * Implements hook_panels_build_alter().
 */
function shop_list_page_panels_build_alter(array &$build, PanelsDisplayVariant $panels_display) {
  // Check for panel variant.
  if ("shop_category_list-panels_variant-0" === $panels_display->getConfiguration()['storage_id']) {
    // Set page title.
    $build['#title'] = $build['#title']->create($contexts['taxonomy_term']->getContextData()->getString());
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.