pepebe
3/31/2014 - 9:45 AM

Hide tree if url paramter qe == 1

Hide tree if url paramter qe == 1

<?php
/*
 Modx Manager Plugin
 info@pepebe.de

 Description: Hide tree on the left side if url paramter qe == 1
 Usage: add &qe = 1 to your quickedit links
 
 Example link: manager/index.php?a=30&id=51&qe=1
 
 Event(s): onDocFormPrerender
*/

$html  = "";

$html .= "<script>";
$html .= "  Ext.onReady(function() {";
$html .= "      q = window.location.search.substring(1);";
$html .= "      o = Ext.urlDecode(q);";
$html .= "      if(o.qe == 1){";
$html .= "          Ext.getCmp('modx-layout').hideLeftbar();";
$html .= "      }";
$html .= "  });";
$html .= "</script>";

$modx->regClientStartupHTMLBlock($html);