I follow GUI extensions, and note examples use either _isEnabled or isEnabled , without underlining. Both seem to be working on extending or possibly replacing existing functionality.
Isenabled
For example, the PowerTools base class (which doesn't seem to extend existing functions) has:
PowerTools.BaseCommand.prototype.isEnabled = function(selection, pipeline) { var p = this.properties; if (!p.initialized) { this.initialize(); } if (!this.isToolConfigured()) { return false; } if (this.isValidSelection) { return this.isValidSelection(selection, pipeline); } return true; };
The tool can use this base class and declare .isValidSelection, for example:
PowerTools.Commands.CountItems.prototype.isValidSelection = function (selection) { ... }
_isEnabled
I see that Anguilla uses ._isEnabled for existing functions (in the Chrome console in many places in the code). For example, WhereUsed has:
Tridion.Cme.Commands.WhereUsed.prototype._isAvailable = function WhereUsed$_isAvailable(selection) ...
Private functions?
I am familiar with the previous underscore, which is a naming convention for private variables. Are _isEnabled and other functions starting with the underscore character "private"? If so, then
- How can we extend (add additional functionality to existing code) these functions?
- How should we replace (not an existing code run, but instead we run instead as an "override")?
I assume the same approach applies to other functions starting with underscores such as _isAvailable and _invoke .
Alvin reyes
source share