This question has been answered by hartus. See the first response.
<?php
switch ($modx->event->name) {
// Add a custom tab to the MODX create/edit resource pages
case 'OnDocFormPrerender':
$custom_html = 'Your custom HTML, e.g. from a model function or API lookup etc.';
$modx->regClientStartupHTMLBlock('<script type="text/javascript">
Ext.onReady(function(){
var tabPanel = Ext.getCmp("modx-resource-tabs");
if(tabPanel!=null){
tabPanel.on(\'tabchange\', function(parent,selectedTab){
if (selectedTab.id == \'modx-ref\') {
Ext.getCmp("modx-resource-content").hide();
}
else {
Ext.getCmp("modx-resource-content").show();
}
});
tabPanel.insert(0, customTab);
tabPanel.setActiveTab(0);
tabPanel.doLayout();
}
});
</script>');
}