It's possible to use tokens in the "Page title" field, so, for example, when overriding the "/node/%" page you can set the "Page title" to "[node:title]" and it'll show the title of the underlying node. However, the UI doesn't say anything about it! :-)

Proposed solutions

  1. Use the token browser (ie. '#type' => 'token_tree') from the 'token' module, or
  2. At least state that tokens can be used, and give the top-level names if possible. So, it could say something like:
    "Tokens can be used here. The following are currently available: [current_user:...], [node:...]"
    
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dsnopek created an issue. See original summary.

dsnopek’s picture

And actually, with /node/% it's probably rare that you want something other than [node:title] so that should probably be the default! I made an issue for that as well: #2561949: Default to a "Page title" of [node:title] on variants for a page at /node/%

dsnopek’s picture

Issue summary: View changes

Type-o in issue summary.

berdir’s picture

The issue that added token support originally had the token browser from token module included but it was removed again to avoid that complexity in the initial branch.

So all we need to do is bring that back. See interdiff in #2287733-27: Configure page title per display

dsnopek’s picture

Title: The UI should mention that you can use tokens in the "Page title" field! » Use token browser for "Page title" field
Issue summary: View changes

Whoa! I thought there wasn't a token browser. Updating the issue summary and title. Thanks! :-)

mmenavas’s picture

I found out I need to use the [term:name] token to set the title of my taxonomy term page.

andrew.trebble’s picture

StatusFileSize
new1.08 KB

I have taken the token browser code that Berdir wrote and retracted for the token browser in #2287733 and updated it a bit.

I wrapped it in a container because it is now just a link so the "Delete this variant" button moves up to the same line if the token tree link isn't wrapped in a div.

chris.smith’s picture

@andrew.trebble - Trying to review the code. Patch applied to the latest development branch, but not able to see the token browser. Maybe I'm missing something.

chris.smith’s picture

Status: Active » Needs review

@andrew.trebble - Realized that I was using the Panel variant and your change applies to Block pages. My mistake. Now that I'm testing the right change, I can confirm that this page works.

Reviewed, and seems to work nicely.

Status: Needs review » Needs work

The last submitted patch, 7: page_manager-2561947-token-browser.patch, failed testing.

berdir’s picture

The module dependency is wrong. It should only be a test dependency, not a full dependency.

gambry’s picture

Status: Needs work » Needs review
StatusFileSize
new891 bytes

Re-rolling #7 + removing the token module dependency.

manuel.adan’s picture

It works for me. The module handler service is actually injected in the PageBlockDisplayVariant class.

manuel.adan’s picture

Version: 8.x-1.x-dev » 8.x-4.x-dev

Updated the target version.

manuel.adan’s picture

Just another approach, this time adding the token browser link to the title field description for a cleaner result.

japerry made their first commit to this issue’s fork.

  • japerry committed c01aed06 on 8.x-4.x
    Issue #2561947 by manuel.adan, andrew.trebble, gambry: Use token browser...
japerry’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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