-
☆ A M B ☆
- 2,475 Posts
I'm trying to follow along with Articles and how to create my own custom resource type. I love Javascript and all, but is there a way to just print some regular old HTML onto the MODX manager page when I'm creating or updating one of my custom resources?
I think whatever the controller returns will be displayed, so HTML should work.
-
☆ A M B ☆
- 2,475 Posts
For CMP's, but not for CRC's. This is painful to have an architecture so addicted to JS.
Ah, I assumed that you were making a CMP to create new ones.
I'm not sure if it would work, but you might try using NewsPublisher to create them in the front end. AFAIK, it works with Articles.
Maybe I'm misunderstanding you, but selecting your Manager page should launch an index.php file. I don't see why that file couldn't contain the equivalent of snippet code that shows whatever plain HTML form you want with a submit button that posts the form, either to a create or update processor, or to itself where the snippet could create or update the object.
Mind you, I've never actually tried this, but I can't think of any reason it shouldn't work.
Notify launches a plain HTML form from a button in the Notify TV in the Manager (although it could just as well be a Top Menu choice). The Notify code doesn't modify the DB, but it easily could.
-
☆ A M B ☆
- 2,475 Posts
CRC's don't launch a custom index.php file that I'm aware of -- you never define that when you're setting them up. CMP's do that, and I've often used plain old HTML. Actually... that makes me think of a good feature request: an optional overridable method to the modResource class where you can specify your own controller. But it'll probably land back in JS land because so much of those controller URLs/paths are req'd by the JS...
I learn something every day here.
I wasn't aware that CRCs used the standard Create/Edit Resource page (never used one). They should definitely have an option to at least launch a custom controller.
You can alter the Create/Edit Resource page in a plugin attached to OnDocFormPrerender, but I don't think it's easy unless you just want to add stuff to the end of it. I'm pretty sure there's an example in my book on doing that to the User Profile form.
[update] Just a thought -- maybe you could use a TV and use Form Customization to show it in the right place.