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

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

lolcode created an issue. See original summary.

lolcode’s picture

Status: Active » Needs review
StatusFileSize
new949 bytes

Attaching a basic patch that fixes this for me.
I am new to this module so I am not sure what is needed for tests.

greg boggs’s picture

looks good. Can you send a merge request? (Green button for "create issue fork"

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

robpowell’s picture

eh 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.

Neslee Canil Pinto made their first commit to this issue’s fork.

neslee canil pinto’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

nicole.harnish’s picture

Hello!

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

mike-kelly’s picture

StatusFileSize
new1.12 KB

This 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.

dotoree’s picture

StatusFileSize
new864 bytes

Rerolled patch for version 2.0.8.

dotoree’s picture

StatusFileSize
new1011 bytes

Rerolled patch for version 2.0.9 .

dotoree’s picture

Rerolled 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.