I want a (node) page titled 'Membership registration' to remain when I display the user registration block on that page, via Layout and block display.

However, when I display that block on the page, the title changes to 'Create new account'.

What am I missing, and (more importantly) how can I prevent the node title from being changed?

Thanks,

Martin

Comments

That sounds strange - may be a bug. Can you describe or, better, paste a snapshot of the Layout you are using to display the node and the block? Are you overriding node/% to do so? Or creating a new path?

I'm overriding the default Layout to display the block on node/58 as you can see here:

I can't imagine why the node title is changed by the display of this block but accept I might be doing something naive!

When the block is not displayed (block removed), the page title is shown as

and when enabled using the visibility condition shown above, the title is changed to:

It's a bit odd and confusing!

You pasted the block configuration snapshot. Can you paste the Layout itself?  

The function user_register_form() does have a line backdrop_set_title(t('Create new account'))

Aha. I'm learning as I go here. Where would I override that?

The function user_register_form() does have a line backdrop_set_title(t('Create new account'))

Interesting. So, it won't be possible to override this, since it's hard coded as part of the form.

Sorry, I'm not sure what you mean. I'm working with the default layout and the Moscone Flipped template. Thanks for replying, I appreciate the help!

And I'm using a subtheme based on bootstrap5_lite.

Instead of visibility conditions on the block, you could try a custom layout for that page, and with visibility conditions on the layout, then try modifying the layout page title itself. Dont know if that would override the hard-coded title, but worth a try?

Instead of visibility conditions on the block, you could try a custom layout for that page, and with visibility conditions on the layout, then try modifying the layout page title itself.

If that doesn't work, there are a couple of other options:

  • Override node.tpl.php (you would need to copy it to node--58.tpl.php inthe templates folder of your theme)
  • Create a custom module that uses hook_FORM_ID_form_alter() to rewrite the title with backdrop_set_title() (hard coding it to whatever you want) 

I would also suggest that you open an issue in the queue. It seems wrong that the form is hard-coding the title. Makes it hard to override it in layouts as you saw...

@nattywebdev I'm unable to reproduce your issue. I've tried with Basis, and the node title is preserved and looks correct when I include the User Registration Form as a block (I'm using the module Form Block to expose that form as a block). See snapshots below. There must be an important detail that I'm not considering. Perhaps it's the node template provided by the subtheme of bootstrap5_lite? Can you try setting Basis as default?

Ignore that!! I had modified the function. Now that it's back to the original I AM able to reproduce the problem. I'll be creating an issue in the Backdrop queue. Hard-coding the title is not a good idea...

I've created an issue in the issue queue. Hopefully someone will suggest a solution - I can't think of a good one other than the hacks I suggested above. I haven't try @dowilmot's suggestions.

Instead of visibility conditions on the block, you could try a custom layout for that page, and with visibility conditions on the layout, then try modifying the layout page title itself.

After trying it, I can now confirm that @docwilmot's suggestion doesn't fix the problem.

Thanks for the support @argiepiano and @docwilmot and I hope a fix will be found.

In the meantime I've made a temporary fix using jQuery to change the title text on the node.