With Corona on the verge of closing schools and daycare in the coming week, i figured it was a good time to do some client-work, so i logged in. Immediately i found a colleague online as well (on a Sunday?!) . Anyway, he was working on a little script that needed some finetuning.
The script was to allow content-navigator render values that were no-longer valid according to EDS / Filenet (think of migrated content). The OOTB implementation would just “hide” them.
Eventually we tinkered the following:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
require([ "dojo/_base/declare", "dojo/_base/lang", "dojo/aspect", "ecm/widget/LayoutPropertiesPane" ], function(declare, lang, aspect, LayoutPropertiesPane) { aspect.around(LayoutPropertiesPane.prototype, "renderAttributes", function(originalrenderAttributes) { return function(attributeDefinitions, item, reason, isReadOnly, params) { attributeDefinitions.forEach(function(def) { function addChoiceIfNotExists(value) { var choiceExists = def.choiceList.choices.some(function(choice) { return choice.value === value }); if (!choiceExists) { def.choiceList.choices.push({ valid: true, displayName: value + " - deprecated", value: value }); } } if (def.choiceList) { if (def.cardinality === "LIST") { item.getValues(def.id).forEach(addChoiceIfNotExists); } else if (def.cardinality === "SINGLE") { addChoiceIfNotExists(item.getValue(def.id)); } else { throw "Unexpected choicelist cardinality"; } } }); originalrenderAttributes.apply(this, arguments); } }); }); |
Credits of course to my colleague with the long name 😉 Bruno Raphael Marques de Santana.