Motivation

Allow using the title of the entity related to the current router object instead of deducing it from the URL.

User interface changes

Add new "Use the page entity title when available" option on the module settings page.

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

Oleksiy created an issue. See original summary.

oleksiy’s picture

Assigned: oleksiy » Unassigned
Status: Active » Needs review
StatusFileSize
new5.7 KB
deaom’s picture

The patch does work and gets the entity title, but because this is a feature request, I'm in no position of saying if this is something that needs to be implemented or not. So I'm leaving it on needs review so others can leave their opinions.

greg boggs’s picture

Thanks for the patch. Can you give me a bit more context? What's the difference between an entity label and page title? How does oneset an entity label on a page? Can you give me an example page to test on?

~G

vacho’s picture

@Greg Boggs the title is the entity label. if you review the patch. There are this code

$title = $entity->label();

For the test, you only need to apply the patch and configure this option at the breadcrumbs configuration form.

Note that the patch difference is this: "Use the real page title when it is available instead of always deducing it from the URL. The page entity title setting above will take precedence over this setting. So, one or the other, but not both." (Extracted from the patch)

greg boggs’s picture

Is there a drupal page we can test on to see this one in action? node/edit maybe?

greg boggs’s picture

Status: Needs review » Needs work

wrong issue.

greg boggs’s picture

Status: Needs work » Needs review
vacho’s picture

StatusFileSize
new2 KB
new3.64 KB

Oh after reviewing the issue more in deep I understand better your questions.

The configuration form already has this option with this description:

- Use the real page title when available
(Use the real page title when it is available instead of always deducing it from the URL.)

However, this not works when the page is an entity like a page_manager(module) instance where the breadcrumb block is showing into a region of this.

In this scenario, I propose a new patch that fixes this.

To test:
Implement a page_manager module, create a page for nodes, add a block to this page to show the breadcrumbs, and note that without the patch the breadcrumb show "Node" not the correct title.

  • Greg Boggs committed d8f854c on 8.x-1.x authored by vacho
    Issue #3165579 by vacho, Oleksiy: Use the page entity title when...
greg boggs’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

philltran’s picture

Looks like the import statement from the patch did not make it to the commit in gitlab.

use Drupal\Core\Entity\ContentEntityInterface;

https://git.drupalcode.org/project/easy_breadcrumb/-/commit/d8f854c67bfb...

This is causing this if statement to be false and skipping loading the entity label.

if ($entity instanceof ContentEntityInterface && $entity->hasLinkTemplate('canonical')) {

philltran’s picture

Here is a patch adding the import.

vacho’s picture

@philtran the last patch #9 has the code use Drupal\Core\Entity\ContentEntityInterface; BTW the current stable version for easy_breadcrumb module has this feature functionally

philltran’s picture

@vacho Thanks for the comment. Looks like it got committed but not noted in this thread. https://git.drupalcode.org/project/easy_breadcrumb/-/commit/5976b2d36dd8...