The block user link in a message is built directly in the preprocess hook and the anchor markup is hardcoded in the template:

<a id="privatemsg-block-user-{{ block_user_id }}" class="privatemsg-block-user use-ajax" href="{{ block_user }}">{{ block_user_text }}</a>

This makes it impossible for other modules to change the link (for example to add a confirmation dialog instead of the instant toggle, or to use a different blocking storage). The only workaround today is to override the whole privatemsg-message.html.twig template and duplicate the link conditions, which breaks on every module update.

Issue fork privatemsg-3635778

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

ivnish created an issue. See original summary.

  • ivnish committed e12bab32 on 2.0.x
    feat: #3635778 Make the block user link in messages a render array with...
ivnish’s picture

Assigned: ivnish » Unassigned
Status: Active » 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.