We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37047 ☆ A M B ☆
    • 309 Posts
    I have a custom date renderer that works perfectly, but currently I have it copied into the grid.renderer.inc.php file along with the other MIGX renderers, which likely will cause pain down the road when I update MIGX.

    Where is the proper place to put a custom renderer?

      Lucy Iannotti
      Following Sea design & development
      http://www.following-sea.com
      New Bedford, MA
      • 4172
      • 5,888 Posts
      the best way, is to create your configs (formtabs and columns) with the MIGX-configurator-CMP
      In the MIGXdb - settings fill the field 'package' with a package-name,
      example: 'mypackage' (allways all lowercase!)

      Then create a file - folder:

      core/components/mypackage/migxconfigs/grid/

      with a file:

      grid.config.inc.php

      put your custom-code there.

      Then you should be able to select your custom-renderer within the columns-definition in the MIGX-configurator.

        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 37047 ☆ A M B ☆
        • 309 Posts
        Thanks Bruno,

        Do I use the Package Manager tab first to create a package, and then use the MIGX tab to add an item and put the name of the package I just created into the MIGXdb-settings ? Or -- do I start with the MIGX tab and add an item and fill in the settings?

        Also, do I need to make the TV first before I use the configurator?
          Lucy Iannotti
          Following Sea design & development
          http://www.following-sea.com
          New Bedford, MA
          • 4172
          • 5,888 Posts
          you can use the package Manager tab to create the package.
          But you can also just add that folder manually, since you don't need a xpdo-package.

          In this case, it is just used to store your custom-files (can be custom configs, backend-templates, grids, processors)

          then you create your grid.config.inc.php - file
          then your configuration (in the MIGX - tab)

          Then you put the name of your configuration into the 'configs' - field of your MIGX-TV and let formtabs and columns empty

          In which order doesn't matter.

          to have your custom-renderer in the listbox, where you can select the renderer for your column, you will need to create your custom-renderer in your grid.config.inc.php first and have added the packagename into the MIGXdb - settings - tab (save and reopen the config to see your renderer in the list)
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 13428 ☆ A M B ☆
            • 1,031 Posts
            Another way is possible too: Create a javascript file containing that custom renderer and register that script with $modx->regClientStartupScript('pathtoyourscript/renderer.js') with a plugin in on 'OnDocFormRender'.

            You have to raw edit the MIGX configuration to select the renderer (it is not selectable in the dropdown).

            That way i.e. Image+ adds a new renderer for MIGX, Collections etc. See: https://github.com/Jako/ImagePlus/blob/master/core/components/imageplus/elements/plugins/imageplus.plugin.php
            https://github.com/Jako/ImagePlus/blob/master/core/components/imageplus/model/imageplus/imageplus.class.php#L243-L264
            https://github.com/Jako/ImagePlus/blob/master/assets/components/imageplus/mgr/js/imageplus.migx_renderer.js
              • 37047 ☆ A M B ☆
              • 309 Posts
              Thanks Jako, that's very interesting. I've been meaning to start learning about Image+ too. Will have a go at both of these methods and report back!
                Lucy Iannotti
                Following Sea design & development
                http://www.following-sea.com
                New Bedford, MA
                • 37047 ☆ A M B ☆
                • 309 Posts
                Hi Bruno, I have not been able to get the new renderer recognized. Can you confirm that path where I'm supposed to put the new grid.config.inc.php file? You had said core/components/mypackage/migxconfigs/grid/
                Is that correct?

                What else should go into the new grid.config.inc.php file? Anything besides the new renderer?

                Edit: I just tried making a grid.mypackage.config.inc.php file containing the custom renderer, and put this file in components/migx/configs/grid/. It works to get the renderer recognized and hopefully will not be overwritten by an update...?!

                BUT - so far this package is not working. I can see the form correctly, and the column headings for the grid, but adding an item just creates a blank line in the grid. I must be missing something in the package but not sure where to look. [ed. note: lucy last edited this post 11 years, 2 months ago.]
                  Lucy Iannotti
                  Following Sea design & development
                  http://www.following-sea.com
                  New Bedford, MA
                  • 9266 ☆ A M B ☆
                  • 77 Posts
                  Lucy,

                  Did you have any luck with this? I am trying something similar with the GoogleMaps TV and was hope you may have some notes on how you got your custom TV to work with MIGX so I can see how to get that one to work.


                  Thanks
                  Ryan
                    • 9266 ☆ A M B ☆
                    • 77 Posts
                    Lucy,

                    Did you have any luck with this? I am trying something similar with the GoogleMaps TV and was hope you may have some notes on how you got your custom TV to work with MIGX so I can see how to get that one to work.


                    Thanks
                    Ryan
                      • 37047 ☆ A M B ☆
                      • 309 Posts
                      Hi Ryan,
                      I'm sorry to say I never did get it to work. I tried Bruno's suggestion, but could not get the custom package working. I did not try Jako's suggestion, because there was no budget left on this project for continuing playing around with it. So right now I have the custom renderer copied into the grid.renderer.inc.php file with a note to myself that I will have to copy it back after updating MIGX. Sorry I'm not more help.
                        Lucy Iannotti
                        Following Sea design & development
                        http://www.following-sea.com
                        New Bedford, MA