Hi,
I have built a project using Alfresco SDK 3.0 and tried to override the getShareServices() in the share-header.lib.js file. I created the modified share-header.lib.js in the following directory of SDK folder sites-webscripts/
sites-webscripts/com/alfresco/share/imports/
and my extension file is like as follow
<module>
<id>custom shareService</id>
<version>1.0</version>
<auto-deploy>true</auto-deploy>
<customizations>
<customization>
<targetPackageRoot>org.alfresco.share.imports</targetPackageRoot>
<sourcePackageRoot>com.alfresco.share.imports</sourcePackageRoot>
<alwaysApply>
<webscript>share-header</webscript>
</alwaysApply>
</customization>
</customizations>
</module>
But the changes are not applied, though the new module is getting registered. Do I need to add anything more?
Thanks.
The targetPackageRoot is incorrect. You are trying to target library scripts, but the targetPackageRoot is actually meant to target the actual web scripts that render a particular page.
Also, you cannot override a function (getShareServices) using the "customization" approach. The original code will already have been run by the point your code is called. Your customisation is supposed to act like a post-processor and modify the result of the original code (in the web script model).
I have achived same goal as below:
1) Extention model.
<extension>
<modules>
<module>
<id>Add custom menu item to header</id>
<version>1.0</version>
<auto-deploy>true</auto-deploy>
<customizations>
<customization>
<targetPackageRoot>org.alfresco.share.header</targetPackageRoot>
<sourcePackageRoot>org.alfresco.share.imports</sourcePackageRoot>
</customization>
</customizations>
</module>
</modules>
</extension>
2) You can override your getShareServices() by updating in the share-header.lib.js
3) Place your updated share-header.lib.js in same folder where share-header.get.js and update path like this where your share-header.lib.js reside in the share-header.get.js
<import resource="classpath:/alfresco/web-extension/site-webscripts/org/alfresco/share/imports/share-header.lib.js">
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.