We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • How would one go about using a custom resource type for a MigxDB-grid based blogging system?

    The ModxTalks commenting system provides a CommentsModxTalks resource type with the commenting built-in.

    I suppose one way would be to add the Resource Type drop-down to the child resource editing pages, but I'd be really happy if there were a way to add a simpler choice, like a single check box, set by default, to make it a CommentsModxTalks type instead of a regular Document type.

    http://modxtalks.artdevue.com/en/help.html
    http://rtfm.modx.com/extras/revo/migxdb/migxdb.tutorials/migxdb.manage-child-resources-in-a-grid-tv-with-help-of-migxdb

    This question has been answered by sottwell. See the first response.

      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
    • discuss.answer
      I am so proud of myself! I figured it out all by myself! Well, it is pretty simple.

      In the MIGx component (Apps in 2.3) in the MIGx tab, edit your config (childstutorial).

      Go to Formtabs, edit Resource.

      Add a field, class_key, with the caption With Comments. It's basically a copy of the show_in_tree field.

      Input TV Type, listbox.

      Go to Input Options and put With Comments==CommentsModxTalks||Without Comments==modDocument

      Now when you add/edit a child to the grid, you'll get an option for add a page with or without comments.

        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
      • And to add it to the grid so you can just click on it to switch resource types from document to document with comments...

        Back in our MIGx configuration, go to the Columns tab. Edit the "Price" field (unless you're using it, in which case add a field).

        Column tab -
        Header: Comments
        Field: class_key
        Column width: 20
        Sortable: No
        Show in Grid: Yes

        Renderer tab -
        Renderer: this.renderSwitchStatusOptions
        onClick: switchOption

        Add two Renderoptions -
        Name: comments (must be one word, this will be used in the HTML)
        Value: CommentsModxTalks
        Image: assets/components/migx/style/images/tick.png

        Name: nocomments
        Value: modDocument
        Image: assets/components/migx/style/images/cross.png

          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org