Skip to content

Instantly share code, notes, and snippets.

@pavel-one
Created April 30, 2018 16:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pavel-one/edfb408d25673f0c47885d75bfe5429d to your computer and use it in GitHub Desktop.
Save pavel-one/edfb408d25673f0c47885d75bfe5429d to your computer and use it in GitHub Desktop.
MODX Extjs Интересные методы
<?php
$eventName = $modx->event->name;
switch($eventName) {
case 'OnDocFormPrerender':
// Для ресурсов с индетификатором шаблона 2
// а также для всех новых ресурсов ( $resource == null )
if( $resource && $resource->get('template') == 2 || !$resource){
$modx->regClientStartupHTMLBlock('<script>
Ext.onReady(function() {
// Добавляем вкладку
MODx.addTab("modx-resource-tabs",{title:"SEO",id:"seo"});
// Прячем ненужные вкладки
MODx.hideRegion("modx-resource-tabs", "modx-panel-resource-tv");
MODx.hideRegion("modx-resource-tabs", "modx-resource-access-permissions");
// Прячем ненужные поля
MODx.hideField("modx-panel-resource", ["modx-resource-content","description"]);
// Переносим TV на вкладку
MODx.moveTV(["tv32"], "seo");
});
</script>');
}
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment