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.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | easy_breadcrumb-use_page_entity_title-3165579-14.patch | 541 bytes | philltran |
| #9 | 3165579-9-release-1_13.patch | 3.64 KB | vacho |
| #9 | 3165579-9.patch | 2 KB | vacho |
| #2 | easy_breadcrumb-use_page_entity_title-3165579-2.patch | 5.7 KB | oleksiy |
Issue fork easy_breadcrumb-3165579
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
Comment #2
oleksiyComment #3
deaom commentedThe 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.
Comment #4
greg boggsThanks 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
Comment #5
vacho commented@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)
Comment #6
greg boggsIs there a drupal page we can test on to see this one in action? node/edit maybe?
Comment #7
greg boggswrong issue.
Comment #8
greg boggsComment #9
vacho commentedOh 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.
Comment #11
greg boggsComment #13
philltran commentedLooks 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')) {Comment #14
philltran commentedHere is a patch adding the import.
Comment #15
vacho commented@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 functionallyComment #16
philltran commented@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...