Problem/Motivation

Sometimes outputting the node title for a mention is not perfect, e.g. if it misses or contains other properties.

Being able to alter the results and especially the resulting link text through a hook would make things a lot more flexible.

Steps to reproduce

Proposed resolution

Let's add two alter hooks in src/MentionsType/MentionsTypeBase.php

  • hook_ckeditor_mentions_build_token_alter()
  • per entity, providing the entity as second parameter allowing to alter $result[$id] as first parameter. This will allow easy access to other entity properties
  • hook_ckeditor_mentions_build_tokens_alter() to simply allow altering the results array.

Remaining tasks

User interface changes

API changes

Data model changes

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

anybody created an issue. See original summary.

anybody’s picture

Title: Allow altering the results, especially visible link text » Allow altering the results, especially visible link text (alter hook)
anybody’s picture

Issue summary: View changes
anybody’s picture

Issue summary: View changes

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

grevil’s picture

Assigned: grevil » anybody
Status: Active » Needs review

All done, please review!

anybody’s picture

Status: Needs review » Reviewed & tested by the community

Perfect!

  • grevil committed e0b11eca on 3.0.x
    feat: #3582395 Allow altering the results, especially visible link text...
grevil’s picture

Assigned: anybody » Unassigned
Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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