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

Generate sortable tag signature with serialized array values #14689

Merged
merged 1 commit into from Sep 17, 2019

Conversation

opengeek
Copy link
Member

What does it do?

Improves the tag signature created by modElement::getTag().

Why is it needed?

When using non-default template engines in MODX (for example, the Fenom implementation by @bezumkin) arrays can be passed as properties. When a tag is generated for the element in these cases, the array will be replaced with the hash of a random string (as arrays are not scalar values). This means that element output can not be matched from the element cache since the random string will never match.
This also allows properties to be so sorted so that the cached output can be matched when similar element tags have a different property order.

Related issue(s)/PR(s)

Replaces #14577 targeting 3.x instead of 2.x, and includes changes suggested in my review of that PR.

Copy link
Contributor

@JoshuaLuckers JoshuaLuckers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have a Unit Test for this (modElement already has a few tests).

@opengeek
Copy link
Member Author

I look forward to your contribution, @JoshuaLuckers ! LOL!

@opengeek
Copy link
Member Author

In all seriousness, I'm not sure there is an easy way to test the array support in this because the default implementation shipped with the core has no way to express a property value as an array. Array property values are something exclusively being done in 3rd party add-ons. I'll see if I can find a way to do this, but I'm afraid it will take some mocking of the parser to emulate something like Fenom or Twig.

@JoshuaLuckers
Copy link
Contributor

I was wondering how I could test this PR, that’s why I suggested a Unit Test.

opengeek added a commit that referenced this pull request Sep 17, 2019
Merge remote-tracking branch 'origin/pr/14689' into 3.x

* origin/pr/14689:
  Generate sortable tag signature with serialized array values in modElement
@opengeek opengeek merged commit cf2ccbb into modxcms:3.x Sep 17, 2019
@opengeek opengeek deleted the improve-getTag branch December 17, 2019 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants