I am creating a plugin that should only effect weblinks. How can I tell if the current item is a weblink?
Thanks
Brian
-
☆ A M B ☆
- 24,524 Posts
$modx->documentObject[’type’] == "reference" (or "document")
I just tried to use this in my plugin that uses onbeforedocformsave and it isn’t working.
$modx->documentObject[’type’] returns nothing.
Can this be used in the backend?
-
☆ A M B ☆
- 24,524 Posts
The documentObject array is only valid when parsing a document. In your case, you’ll need to take a look at the actual form values being sent via POST. Line 30 of manager/processors/save_content.processor.php has
so $_POST[’type’] is what you want to check.