For example, I placed on [node:body] token, then if the value of body is null, the [node:body] will be directly shown on page title. I think instead of showing the token name, it should display nothing.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ParisLiakos’s picture

Subscribe

ParisLiakos’s picture

Status: Active » Needs review
FileSize
599 bytes

i solved this with way in the attached patch

petrovnn’s picture

Assigned: Unassigned » petrovnn

thank you rootatwc, yours patch works fine!
Please commit it in main branch, why it did not happen?
Why not close the issue?

ParisLiakos’s picture

Status: Needs review » Reviewed & tested by the community

Because it needed someone like you to confirm that works!

thanks. now its up to maintainers to commit it

FAAREIA’s picture

It works fine =).
Many thanks for the patch

Mile23’s picture

Version: 7.x-2.5 » 7.x-2.x-dev

The tests in 7.x-2.x dev are much much better than the ones in 7.x-2.7, though I don't see one for behavior with a null token object.

This patch applies cleanly, though.

Liliplanet’s picture

The patch works perfectly, thank you! please commit to latest version ..

mariancalinro’s picture

Assigned: petrovnn » Unassigned
Issue summary: View changes
Status: Reviewed & tested by the community » Needs review
FileSize
1.02 KB

From my point of view, displaying nothing is not a good option, you generally want to display something in your page title.

So my approach is to check the page title if it still has tokens that have not been replaced, and if so, fallback to the default pattern.

This makes sure you always have a page title, and that you do not get a page title with a token in it.

csanders’s picture

The patch in #8 worked like a charm for me, thanks!

nicholasThompson’s picture

Status: Needs review » Fixed

Patch in #8 applied to master in d4073217cb53681ce915f81f134e8c99904871f1.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.