Add back a simple page title getter

Created on 10 May 2014, over 10 years ago
Updated 17 February 2023, almost 2 years ago

Problem/Motivation

Drupal 7:

  $title = drupal_get_title();

Drupal 8:

  $request = \Drupal::request();
  if ($route = $request->attributes->get(\Symfony\Cmf\Component\Routing\RouteObjectInterface::ROUTE_OBJECT)) {
    $title = \Drupal::service('title_resolver')->getTitle($request, $route);
  }

Do I need to tell more how is this wrong?

Proposed resolution

$title = Foo:bar()

Remaining tasks

Come up with a name, implement it.

User interface changes

API changes

📌 Task
Status

Needs work

Version

10.1

Component
Routing 

Last updated 3 days ago

Created by

🇨🇦Canada chx

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇫🇷France andypost

    There's WIP patch

  • Status changed to Needs work almost 2 years ago
  • The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • Status changed to Needs review almost 2 years ago
  • 🇮🇳India mrinalini9 New Delhi

    Rerolled patch #12 for 10.1.x, please review it.

    Thanks & Regards,
    Mrinalini

  • Status changed to Needs work almost 2 years ago
  • 🇺🇸United States smustgrave

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.

    This needs an issue summary update as the title and description talk about adding a getting method. But the patches are updating comments.

Production build 0.71.5 2024