Carry over destination in relationship add links

Created on 24 September 2024, 6 months ago

Problem/Motivation

When you click "Add member" on the Members tab, the action link contains a destination that will redirect the user back to the Members page. This is done by using the WithDestination plugin. However, this is not the case for other relationships.

You can easily instruct the action link to use that class with the following:

function MY_MODULE_menu_local_actions_alter(&$actions) {
  $actions['my_action_id]['class'] = \Drupal\group\Plugin\Menu\LocalAction\WithDestination::class;
}

However, for entities that have bundles, the destination is not carried over in the links available on the next page where you select the relationship type.

Steps to reproduce

Install and configure any of the following modules:

  • group:gnode
  • group_term:group_term
  • commerceg:commerceg_product
  • Notice that when you relate an existing entity to the group, you are directed to the relationship page.

    Proposed resolution

    Use the destination query parameter, if it exists, when creating the links on the page that the relationship type is selected.

Feature request
Status

Active

Version

3.3

Component

Code

Created by

🇵🇪Peru krystalcode

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