Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.x] Fix functionality in the section "Categories" of the elements tree #16488

Closed

Conversation

halftrainedharry
Copy link
Contributor

What does it do?

In some handler-functions, the information about the clicked item (type and id) gets extracted from the node-ID in the tree.
In most sections, the IDs have the prefix n_.
In the "Categories" section, nodes for other types have the prefix n_c_ instead:

'id' => 'n_c_'.$elementIdentifier.'_element_'.$element->get('id').'_'.$element->get('category'),

This is now taken into account.

Why is it needed?

Some context menu items don't work correctly, when executed for element types (other than "Category") in the "Categories" section of the elements tree.

modx_manager_elements_categories_tv_remove

How to test

Go to the section "Categories" in the elements tree and check that the following options (in the context menu) now work:

  • Remove <type> (for the types "Template", "TV", "Chunk", "Snippet" and "Plugin")
  • Activate and Deactivate Plugin (for type "Plugin")
  • Create a New <type> here (for the types "Template", "TV", "Chunk", "Snippet" and "Plugin")

Related issue(s)/PR(s)

Resolves #16487 for MODX 2.x

@Ruslan-Aleev Ruslan-Aleev added pr/review-needed Pull request requires review and testing. pr/port-to-3 Pull request has to be ported to 3.x. labels Oct 23, 2023
@smg6511
Copy link
Collaborator

smg6511 commented Oct 23, 2023

@halftrainedharry - Funny we worked up something for this at the same time! I did so for 3.x though. Perhaps we can review each other's solutions? I'll review yours in the next day or two...

@smg6511
Copy link
Collaborator

smg6511 commented Oct 24, 2023

@halftrainedharry - I assume, since you closed this PR, you want me to apply the changes I made for my 3.x PR to a new 2.x PR. Let me know if that's the case or if you're working on it; just don't want to duplicate efforts ;-)

@halftrainedharry
Copy link
Contributor Author

I assume, since you closed this PR, you want me to apply the changes I made for my 3.x PR to a new 2.x PR.

Yes, that's correct.

opengeek added a commit that referenced this pull request Mar 25, 2024
### What does it do?
Adds a new tree method to properly extract Element data from the working
tree Node. There are three patterns for a Node's id, but only one was
being accounted for in the code. Additionally, cleans up code formatting
in the affected methods.

### Why is it needed?
Within the Categories tree, these actions are currently inoperable:
- Element removal
- Plugin activation/deactivation

### How to test
1. Create a handful of Elements (at least one of each type), both within
a Category and within the root (no Category)
2. Verify the ability to remove each Element (from both the Categories
tree and from within the individual Element trees)
3. Verify the ability to activate/deactivate Plugins (from both the
Categories tree and from within the individual Element trees)

### Related issue(s)/PR(s)
Resolves #16487 for MODX 3.x
Related to 2.x solution #16488

---------

Co-authored-by: Jason Coward <jason@opengeek.com>
opengeek added a commit that referenced this pull request Mar 25, 2024
### What does it do?
Adds a new tree method to properly extract Element data from the working
tree Node. There are three patterns for a Node's id, but only one was
being accounted for in the code. Additionally, cleans up code formatting
in the affected methods.

### Why is it needed?
Within the Categories tree, these actions are currently inoperable:
- Element removal
- Plugin activation/deactivation

### How to test
1. Create a handful of Elements (at least one of each type), both within
a Category and within the root (no Category)
2. Verify the ability to remove each Element (from both the Categories
tree and from within the individual Element trees)
3. Verify the ability to activate/deactivate Plugins (from both the
Categories tree and from within the individual Element trees)

### Related issue(s)/PR(s)
Resolves #16487 for MODX
3.0.x
Related to 2.x solution #16488
Port of 3.x solution #16489

---------

Co-authored-by: Jim Graham <jim@pixelsandstrings.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/port-to-3 Pull request has to be ported to 3.x. pr/review-needed Pull request requires review and testing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants