Element Properties and Property Sets
Some thoughts on using properties and property sets in MODX Revolution
MODX Evolution’s Snippet Parameters were reinvented in Revolution as Element Properties: any Element can now have them, not just Snippets. And in addition, Property Sets. Groups of properties that any number of Elements can share, in a variety of ways. Cool, huh!?
There are a lot of new approaches you can take in Revolution to customizing not only individual Elements, but groups of Elements as well through the use of Property Sets. Take the time to learn about this powerful new feature in MODX Revolution, and hopefully, like me you’ll start seeing a lot of new innovative ways to take advantage of them.
getResources and getPage
As an example, my new site here is constructed with three main top-level containers: Journal, Creative, and Technology. Throughout these Resources, and their children, I have applied consistent parameters to all of my getPage and getResources calls through the use of Property Sets; one for each main container.
First, here is the content of the top-level Technology Resource:
This call provides the appropriate properties to the getResources call to get the most recent five child Resources that are not containers. But I’ve also included the properties necessary to handle a call to getPage in the same set, so the 2010 container content consists of:
[[getPage@technology]] <ul class="pageList"> [[!+page.nav]] </ul>
This provides the same, consistent set of properties to the getResources call that getPage performs, as well as the additional properties necessary for getPage itself. Here is the Property Set, for reference: