share-header.lib.js override doesn't work in Alfresco SDK 3.0

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

share-header.lib.js override doesn't work in Alfresco SDK 3.0

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.

1 Reply
Highlighted
Master

Re: share-header.lib.js override doesn't work in Alfresco SDK 3.0

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).