Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save krasnikovdev/f32ab6c1eea9ce78bd74ff9db3577d56 to your computer and use it in GitHub Desktop.
Save krasnikovdev/f32ab6c1eea9ce78bd74ff9db3577d56 to your computer and use it in GitHub Desktop.
Plugin
____________________________
<?php
if($modx->event->name != 'OnDocFormRender' || $resource->get('template')!= 1) return '';
$modx->controller->addLastJavascript('/assets/components/myfields/js/mgr/resource/field.js');
js
___________________________
Ext.override(MODx.panel.Resource, {
getParentMainRightFields: MODx.panel.Resource.prototype.getMainRightFields,
getMainRightFields: function (config) {
var parentMainRightFields = this.getParentMainRightFields.call(this, config);
parentMainRightFields.push({
xtype: 'modx-combo-user-new'
,fieldLabel: _('user')
,name: 'user'
,id: 'modx-resource-createdby'
,maxLength: 255
,anchor: '100%'
,value: config.record.createdby || ''
,renderer: true
});
return parentMainRightFields;
}
});
MODx.combo.UserNew = function(config) {
config = config || {};
Ext.applyIf(config,{
hiddenName: 'createdby'
,displayField: 'username'
,valueField: 'id'
,fields: ['username','id']
,pageSize: 20
,url: MODx.config.connector_url
,baseParams: {
action: 'security/user/getlist'
}
,typeAhead: true
,editable: true
});
MODx.combo.User.superclass.constructor.call(this,config);
};
Ext.extend(MODx.combo.UserNew,MODx.combo.ComboBox);
Ext.reg('modx-combo-user-new',MODx.combo.UserNew);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment