Problem/Motivation
The current page title itself is not truncated when selecting "Truncate the page's title to a maximum number."
Also I would like to suggest a wording revision changing this to: "Truncate the page's title to a maximum length.". If this should be a separate issue let me know.
Steps to reproduce
* Enable the option "Truncate the page's title to a maximum number." and choose a short length with or without elipsis'.
* Also choose the option: "Include the current page as a segment in the breadcrumb"
* Create a node with a long title
* Note that the current page title is not shortened
Proposed resolution
Use the truncator function in the code segment below which seems to handle the current page title.
elseif ($route_match->getRouteObject()) {
$url = Url::fromRouteMatch($route_match);
if ($this->config->get(EasyBreadcrumbConstants::ABSOLUTE_PATHS)) {
$url->setOption('absolute', TRUE);
}
$links[] = new Link($title, $url);
}
Remaining tasks
* Provide patch
* Update tests
User interface changes
None
API changes
None
Data model changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | easy_breadcrumb-page-title-truncate-3203311-15.patch | 996 bytes | dotoree |
| #14 | page-title-is-not-truncated-3203311-14.patch | 1011 bytes | dotoree |
| #13 | page-title-is-not-truncated-3203311-13.patch | 864 bytes | dotoree |
| #12 | easy_breadcrumb_fix_truncation.patch | 1.12 KB | mike-kelly |
| #2 | page-title-is-not-truncated-3203311-2.patch | 949 bytes | lolcode |
Issue fork easy_breadcrumb-3203311
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
lolcode commentedAttaching a basic patch that fixes this for me.
I am new to this module so I am not sure what is needed for tests.
Comment #3
greg boggslooks good. Can you send a merge request? (Green button for "create issue fork"
Comment #6
robpowelleh this isn't quite right, we don't want to rerun truncate if it has already run and we don't want to run it if the config isn't set to do so.
Comment #9
neslee canil pintoComment #11
nicole.harnish commentedHello!
I am still having this issue and after looking further into it, it looks like the actual fix was removed when the config check was committed.
https://git.drupalcode.org/project/easy_breadcrumb/-/merge_requests/13/d...
Can we make this update again?
Thanks!!
Nicole
Comment #12
mike-kelly commentedThis wasn't working for me... the issue was that the truncation was not applied when using the current page title token in the breadcrumb.
See attached patch for fix.
Comment #13
dotoree commentedRerolled patch for version 2.0.8.
Comment #14
dotoree commentedRerolled patch for version 2.0.9 .
Comment #15
dotoree commentedRerolled patch for 2.0.9 with LF line endings.
The previous patch (-14) had CRLF line endings which caused cweagans/composer-patches v2 to silently fail with "No available patcher was able to apply patch" on Linux servers. The patch content is identical — only the line endings were changed.