Related to #2727483: Add new condition: to check if menu link already exists. Over there the solution is to add new rules condition. Here, I'm adding new params to existing rules actions, see the rationale below.

Problem/Motivation

I'm using rules and menu_rules to automatically create menu links. There are 3 use cases which the module cannot satisfy:
1. I need to check if menu link already exists. If yes, prevent creating the same link. Please check the other issue I started #2727483: Add new condition: to check if menu link already exists to solve this use case using rules condition. The patch in this thread is meant for solving this use case using action in order to satisfy the second use case.
2. If menu link already exists, the action still provide the menu link as rules variable, just that it's providing the previously created menu link, because no new menu link is created. Separating the check to rules condition as in #2727483: Add new condition: to check if menu link already exists doesn't allow me to satisfy this second use case.
3. When creating new link, I want to choose if the link is appended at the start or at the end of the existing menu items within the same level.

Proposed resolution

Patch in comment #2. The patch adds the following params to the existing actions:

Action menu_rules_create_arbitrary_item:
- param prevent_duplicate: to prevent duplicate creation of menu link if the path already exists previously
- param position: to determine the position of the new menu link item, before or after the existing menu links within the same level

Action menu_rules_create_item:
- param position: to determine the position of the new menu link item, before or after the existing menu links within the same level

Remaining tasks

Test and merge.

User interface changes

Add new parameters in existing rules actions, see above for detailed explanation.

API changes

None.

Data model changes

None.

Comments

loziju created an issue. See original summary.

loziju’s picture

Status: Active » Needs review
StatusFileSize
new4.62 KB
Munavijayalakshmi’s picture

Assigned: Unassigned » Munavijayalakshmi
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new23.62 KB