We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39251
    • 53 Posts
    Do you (or anyone) happen to know where in the code it actually renders the resource editor? I ended up hacking part of the source code to get this to work and I'd like to see if I can make the changes I made using *twitch* ExtJS in the plug-in instead.

    The $scriptProperties in "OnDocFormPrerender" contains all of the html I need to modify to display the user's changes on the form, but that particular version of $scriptProperties happens to be 58562 lines long for this particular (small) resource and I haven't been able to figure out how to, say, just access the the TV buried deep in there with the name "listing-contact-phone" or even how to loop through those TVs at all. And they're all in there three times, which isn't helping me figure this out... (The 58k line issue is really making it hard to make sense of this object.)

    I just need to modify the formElement of any that have been edited, and that's the only place they seem to be available in any of the events. I figure the code has to loop through them somehow to output them, so with any luck, can learn something there.

    Right now, I'm doing it in manager/controllers/default/resource/resource.class.php, and it works (quite well, actually), but I'd really like to do this without hacking the core files.
      If there's a better way to do it, I'll find it.
      • 3749
      • 24,544 Posts
      You might get some clues here: http://rtfm.modx.com/display/revolution20/Creating+a+Resource+Class. I'm not sure if you want an actual CRC, but it might give you some insight into the process.

      You might also look in the code for modx-panel-resource-tv. That's the panel where the TVs are rendered.

      I also found this code in manager/assets/modext/widgets/resource/modx/panel.resource.tv.js:

      Ext.extend(MODx.panel.ResourceTV,MODx.Panel,{
          autoload: function() {
              return false;
          }
          ,refreshTVs: function() {
              return false;
              var t = Ext.getCmp(this.config.templateField);
              if (!t && !this.config.template) { return false; }
              var template = this.config.template ? this.config.template : t.getValue();
              
              this.getUpdater().update({
                  url: MODx.config.manager_url+'index.php?a='+MODx.action['resource/tvs']
                  ,method: 'GET'
                  ,params: {
                     'class_key': this.config.class_key
                     ,'template': template
                     ,'resource': this.config.resource
                  }
                  ,scripts: true
                  ,callback: function() {
                      this.fireEvent('load');
                      if (MODx.afterTVLoad) { MODx.afterTVLoad(); }
                  }
                  ,scope: this
              });
          }
      });





      ------------------------------------------------------------------------------------------
      PLEASE, PLEASE specify the version of MODX you are using.
      MODX info for everyone: http://bobsguides.com/modx.html [ed. note: BobRay last edited this post 14 years, 2 months ago.]
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting