Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
I figured it out. The actual place to look into is/was epi-cms/widget/ReadOnlyContentList
- this component has a protected method, called _getBaseSettings()
which returns configuration item, with direct reference to formatters.contentItemFactory()
method.
So what I did, in module initializer I have put together following code:
define([
"dojo",
'dojo/_base/declare',
// Parent class
'epi/_Module',
// Commands
'alloy/AlloyFormatters',
"epi-cms/widget/ReadOnlyContentList",
// epi
"epi/shell/dgrid/Formatter",
"epi-cms/core/ContentReference",
"epi-cms/dgrid/formatters"
], function (
// Dojo
dojo,
declare,
// Parent class
_Module,
AlloyFormatters,
ReadOnlyContentList,
Formatter,
ContentReference,
formatters
) {
return declare([_Module], {
initialize: function () {
this.inherited(arguments);
/*
* Overriding default implementation of _getBaseSettings() method
*/
ReadOnlyContentList.prototype._getBaseSettings = function (contextMenu) {
/*
* This part is copy/pasted from original implementation
*/
var titleSelector = function (item) {
var reference = new ContentReference(item.contentLink);
return formatters.title(item.name, reference.id, item.contentTypeName);
};
var thumbnailSelector = function (item) {
return item.thumbnailUrl;
};
/*
* Here I build reference to my implementation of contentItemFactory() implementation
*/
var alloyFormatter = AlloyFormatters.contentItemFactory("name",
titleSelector,
null,
contextMenu,
thumbnailSelector,
undefined,
undefined,
true);
/*
* Returning object - only `formatters` option is overriden, rest is as in default implementation
*/
return {
store: this.store,
queryOptions: this.queryOptions,
formatters: [alloyFormatter],
deselectOnRefresh: true,
sort: this.queryOptions && this.queryOptions.sort
};
}
}
});
});
now my code runs :)
I'm looking for ways to improve experience for editors by adding some more information into the block search reusults or the tooltip:
I've explored a lot of files, and I think what I have to do is to add or override default formatter to
\epi_modules\CMS\11.24.1\ClientResources\epi-cms\dgrid\formatters
. Haven't found much resources.What I tried so far:
ClientResources\epi-cms\dgrid\formatters.js.uncompressed.js
to\ClientResources\Scripts\AlloyFormatters.js
What I observe in when I debug the code is following:
Formatter.addFormatter("contentItem", module.contentItemFactory, true);
effectively overriding default implementation provided by default modules:As you can see, it's the default implementation of contentItem formatter resolved, and not mine from AlloyFormatters.
As I'm no dojo-expert, I feel like I'm missing something very simple.