Add an alter hook to change labels of/exclude individual matches

Created on 2 April 2024, 10 months ago
Updated 10 April 2024, 9 months ago

Problem/Motivation

I had another idea: maybe we could improve the tagify_autocomplete_matches alter hook. Currently, it's not that useful since the entity object is not passed. Only the label strings are passed, but they generally don't contain enough information to make decisions.

Proposed resolution

Add a tagify_autocomplete_match alter hook. We call it after $this->token->replacePlain() and we pass the $entity, $label (as reference, so we can change it) and $info_label (also as reference, so we can change it). If a hook implementation returns FALSE, the match is not included in the results.

Deprecate the existing hook_tagify_autocomplete_matches_alter() and hook_tagify_user_list_autocomplete_matches_alter(). The distinction is not necessary with the new hook, since you can check $entity->getEntityTypeId() === 'user'.

I can implement this if you want, just let me know if you think it's a good idea.

Feature request
Status

Fixed

Version

1.2

Component

Code

Created by

🇧🇪Belgium dieterholvoet Brussels

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024