We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44950
    • 7 Posts
    I know this is an old one, but I recently came across the same issue. Primarily the issue is due to ModX removing the TV's from the Template Variables tab via javascript; specifically the moveTV method in the modx.js file. I resolved this by over-riding this method:

    1: Create a js file somewhere in the manager. I created one in manager/assets/overrides/modx.js
    2: Add the following to the file:
    MODx.moveTV = function(tvs,tab) {
        if (!Ext.isArray(tvs)) { tvs = [tvs]; }
        var tvp = Ext.getCmp('modx-panel-resource-tv');
        if (!tvp) { return; }
    
        for (var i=0;i<tvs.length;i++) {
            var tr = Ext.get(tvs[i]+'-tr');
    
            if (!tr) { return; }
            var pn = tr.parent().id;
            var fp = Ext.getCmp(tab);
            if (!fp) { return; }
            fp.add({
                html: ''
                ,width: '100%'
                ,id: 'tv-tr-out-'+tvs[i]
                ,cls: 'modx-tv-out'
            });
            fp.doLayout();
    
            var o = Ext.get('tv-tr-out-'+tvs[i]);
            o.replaceWith(tr);
            if (Ext.query('#' + pn  + ' .modx-tv').length == 0) {
                Ext.get(pn).remove();
            }
        }
    };

    3: Create a plugin called 'ManagerOverrides' and add the following to the 'OnManagerPageInit' event:
    <?php
    switch ($modx->event->name) {
        case 'OnManagerPageInit':
            $jsFile = '/manager/assets/overrides/modx.js';
            $modx->regClientStartupScript($jsFile);
            break;
    }
    return;


    And your empty tabs should disappear when you put TVs into their own Tab via Form Customization.

    Please note that this doesn't (I think) also remove the Template Variables tab should the event of moving all TVs to their own tab mean that the TVs tab is now empty. But someone should be able to expand on it should it be needed.