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:
- Copied
ClientResources\epi-cms\dgrid\formatters.js.uncompressed.js
to\ClientResources\Scripts\AlloyFormatters.js
- Created Initializer.js file:
define(["dojo",'dojo/_base/declare', // Parent class'epi/_Module', // Commands'alloy/AlloyFormatters' ], function ( // Dojo dojo, declare, // Parent class _Module, AlloyFormatters ) { return declare([_Module], { initialize: function () { this.inherited(arguments); } }); });
- Updated module config to initialize my module after Shell and CMS:
<?xml version="1.0" encoding="utf-8"?><module><assemblies><!-- This adds the Alloy template assembly to the "default module" --><add assembly="AlloyDemo" /></assemblies><clientResources><add name="epi-cms.widgets.base" path="Styles/Styles.css" resourceType="Style"/></clientResources><clientModule initializer="alloy.Initializer"><moduleDependencies><add dependency="Shell" type="RunAfter" /><add dependency="CMS" type="RunAfter" /></moduleDependencies></clientModule><dojo><!-- Add a mapping from alloy to ~/ClientResources/Scripts to the dojo loader configuration --><paths><add name="alloy" path="Scripts" /></paths></dojo></module>
What I observe in when I debug the code is following:
- Default formatters register, by calling Formatter.addFormatter() method:
- My module is initialized, and calls method
Formatter.addFormatter("contentItem", module.contentItemFactory, true);
effectively overriding default implementation provided by default modules: - However, when I type something in the block search field, and break in the JS, the formatter that is being picked is always the default one:
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.