Hi,
I'm a newbie and maybe this is a stupid question...
I was learning to make a plugin and in a lot of examples there is this code: &$modx->resource->_output
My doubt is: just like _output , which more values can we access? Is there a list anywhere? Where this _output come from ?
I couldn't find this information anywhere..
Could you guys help ?
Thanks!
-
☆ A M B ☆
- 24,524 Posts
The easiest thing, imo, is to have a good code editor like PhpStorm that will do a relatively quick search of the entire MODX codebase. Then you can search for something like OnWebPagePrerender and see exactly which variables are being passed.
If the event is resource-related, you can count on $resource being passed and all the fields listed here are available as $resource->fieldName:
http://bobsguides.com/modx-object-quick-reference.html#modResource
-
☆ A M B ☆
- 24,524 Posts
Actually most of the properties aren't intended for public use; the MODx core uses them internally. There are generally public API getter and setter functions for using them, making sure they're used in a sane and secure fashion.
Yes, as Susan says, anything that starts with an underscore is meant to be used internally. Some of us do cheat and use them occasionally. I'm not sure if there's a good public alternative to $resource->_output, though, and I know it's used fairly often, so I think it's relatively safe.