We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36805
    • 354 Posts
    First of all thanks Mikko/maagit for QM+, you did a terrific job! I have been playing with the new inline add resource function of QM+ and it is totally AWESOME!

    I use it to add a document with the parent being the current document like so:
    <!-- qm-new [*id*] 5 'New block item' -->
    By a simple ditto call in the parent i can display all children in floating boxes. Hello dynamic layout!

    I have one question however: Is it possible to make QM+ return to the page it was called from rather than to the document I just created?
      • 36805
      • 354 Posts
      I have solved it by writing a plugin. It is triggered OnDocFormSave and checks whether the document was being saved with QM+. If it is it forwards to the parent.

      I’ve added a check for a specific template I use for page blocks so you can still get the normal behaviour for non-block documents. Probably one should make that configurable by the plugin configuration.

      Maybe this is useful to someone else too..
      $e = &$modx->Event;
      switch ($e->name)
      {
          case "OnDocFormSave":
              if (intval($_REQUEST['quickmanager']) == 1)
              {
                  $doc = $modx->getDocument($id, 'template');
                  $parent = $modx->getParent($id, 0, 'id,template');
                  if ($doc['template']== 5)
                       $modx->sendForward($parent['id']);
              }
              break;
      }
      
        • 16610
        • 634 Posts
          Mikko Lammi, Owner at Maagit
          • 36805
          • 354 Posts
          Thanks I’ll use that instead. It’s certainly more KISS smiley

          Ahwell at least I’ve brushed up on my plugin/modx api knowledge wink