I want the page title block to display on the contact form pages, because the nodes have their titles in their display.

It seems for a form you can't add the title to the form display, thus leaving me with the option to display it via the page title core block.

What I've tried as configuration for the block under visibility:

  • Contact form bundle: none selected (= for me, assuming: all)

Page title configuration: contact form bundle settings

  • Custom menu link bundle: Negate the condition (= for me, assuming: none)
  • Content type: Negate the condition (= for me, assuming: none)
  • Redirect type: Negate the condition (= for me, assuming: none)
  • All other configurations -> untouched (= for me, assuming: all)

Page title configuration: other configuration

But, the page title is never being displayed. Only when I deselect everything I see my page title... but I only need it on some pages.

Summarized, I want to only display the page title on specific pages, in a structural way (which means: no CSS hack)

  • So you're suggesting to create a new block with a module and adding this to the page with my custom/copied html? Although it is an option, isn't this a very circuitous approach?
    – ReBa
    Aug 27, 2016 at 9:06
  • So for each contact form, you suggest a custom block? I only see that option as the last one to implement as it is not very constructive to dynamic development...
    – ReBa
    Aug 27, 2016 at 9:38
  • I am now having two contact pages. But it could be that the user (who is not the superuser) wants to add new forms. I'll have to explain the process of creating new custom blocks too then? The average Joe or Jane doesn't like working like that, isn't it?
    – ReBa
    Aug 27, 2016 at 9:57
  • I've deleted the previous comments to avoid clutter. Aug 27, 2016 at 10:12

2 Answers 2


You only need to select the Contact form bundles you want to display the page title on. Leave anything else untouched.

  • The strange thing is, if I do this approach, it doesn't include the block. I think this should be the standard approach. I've tried this before and tried this again. I'm considering this for now as a bug(?).
    – ReBa
    Aug 27, 2016 at 9:04
  • 2
    It's a bug in ctools: drupal.org/node/2695955
    – 4uk4
    Sep 1, 2016 at 20:46

What about doing it in hook_from_alter()? Something like this should work, but I think this will screw with the login block as well, something to watch out for:

function hook_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  switch ($form_id) {
    case 'user_login_form';
    case 'user_register_form';
    case 'user_pass';
      $request = \Drupal::request();
      $route_match = \Drupal::routeMatch();
      $title = \Drupal::service('title_resolver')->getTitle($request, $route_match->getRouteObject());
      $form['title'] = array(
        '#theme' => 'page_title',
        '#title' => $title,
        '#weight' => -1000,

Problem is of course the title is below the tabs.

  • The problem is indeed that the location of the title element is not in the correct place. It resides inside the form. This could be a sufficient approach, if the design allows this. Otherwise, you'll have to add a container around the form except for the title leaving it to be a considerable option.
    – ReBa
    Aug 27, 2016 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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