Sometimes, the needs of a business aren’t covered by the gadgets that are included by default in Nuxeo; because of that, new gadgets can be developed so that users or workers in the business can count on the information that they need. These gadgets will be part of a larger plug-in which could contain other gadgets.
The problem comes up when we try to migrate a gadget developed for Nuxeo 5.4.2, or a version that predates version 5.6 or an even earlier version of Nuxeo, given that the platform has changed the way in which it interprets gadgets.
As such, if we want our old gadget to keep functioning when we update the platform to a newer version, we need to follow a few simple steps that we’re going to describe below:
First, open the .xml file of the gadget that you want to migrate. You’ll generally find a list of scripts and various methods in this file.
Cut all the methods that you’ve got inside the .xml of the gadget so that you can paste them into another file.
Create a file with a .js extension (such as GADGET_SCRIPT.js) in
/nuxeo.war/scripts/and paste the section of code that you cut in Step 1.
Create a contribution in an .xml file, and after the dot in the "resources" extension of the "org.nuxeo.theme.services.ThemeService" component that indicates the route of the new .js file created in Step 2, and don’t forget to refer to this contribution from the “Nuxeo-Component” section of MANIFEST.MF of the plug-in that the gadget belongs to.
que indique la ruta del nuevo fichero .js creado en el paso anterior y además referencia esta contribución desde la sección "Nuxeo-Component" del MANIFEST.MF del plugin al que pertenece el gadget.
In the gadget’s .xml file (the same one as in Step 1), you substitute the following in all of the lines of the scripts:
and exchange them with the one line of the code below:
Finally, add the last script you created to the previous list with the methods you extracted from the .xml file of the gadget. (In the example below, we’ve called the script "GADGET_SCRIPT.js"):