Hello
I tried to override the getSiteData() in the share-header.lib.js file. I created the modified share-header.get.js in the following directory of SDK folder sites-webscripts/
sites-webscripts/com/alfresco/share/header/
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.header</targetPackageRoot>
<sourcePackageRoot>com.alfresco.share.header</sourcePackageRoot>
</customization>
<customization>
<targetPackageRoot>org.alfresco.share.pages</targetPackageRoot>
<sourcePackageRoot>com.alfresco.share.header</sourcePackageRoot>
<alwaysApply>
<webscript>share-header</webscript>
</alwaysApply>
</customization>
</customizations>
</module>
My file:share-header.get.js
<import resource="classpath:/alfresco/site-webscripts/org/alfresco/share/imports/share-header.lib.js">
model.jsonModel = {
rootNodeId: "share-header",
services: getHeaderServices(),
widgets: [
{
id: "SHARE_VERTICAL_LAYOUT",
name: "alfresco/layout/VerticalWidgets",
config:
{
widgets: getHeaderModel()
}
}
]
};
getSiteData(){
...
}
But the changes made are not supported. Do I need to add anything more?
Thanks.
Solved! Go to Solution.
Can you explain what you are trying to achieve, there might be a better way to do it.
However, following your comments, If you are following documentation:
https://docs.alfresco.com/5.2/tasks/dev-extensions-share-tutorials-custom-share-header-menu.html
https://docs.alfresco.com/5.2/concepts/dev-extensions-share-override-ootb-surf-webscripts.html
And If you are extending share header menu, items etc., this should be enough to extend them.
<module>
<id>custom shareService</id>
<version>1.0</version>
<auto-deploy>true</auto-deploy>
<customizations>
<customization>
<!-- extension for share header -->
<targetPackageRoot>org.alfresco.share.header</targetPackageRoot>
<sourcePackageRoot>com.alfresco.share.header</sourcePackageRoot>
</customization>
</customizations>
</module>
Since you are trying to extend the 'share-header.lib.js', it can't be done via 'customization' (extension module). The 'customisation' does post-processing which is used to add/update the result of the ootb webscripts and it is targetted to extend webscripts not a library.
Use: widgetUtils.findObject(model.jsonModel, "id", "ID") instead to modify/update any existing widgets.
In worst case, if you have to make changes in 'share-header.lib.js' then it needs to be copied in web-extension directory as: /alfresco/web-extension/site-webscripts/org/alfresco/share/imports/share-header.lib.js
Also copy the original share-header.get.js to the path: /alfresco/web-extension/site-webscripts/org/alfresco/share/header/share-header.get.js
Update the 'share-header.get.js' import statement:
<import resource="classpath:/alfresco/web-extension/site-webscripts/org/alfresco/share/imports/share-header.lib.js">
This may work and any changes made to share-header.lib.js may be visible. Also you won't need 'customization' (i.e. no need of creating the extension module as done above). I wouldn't recommend doing this though because it is not correct approach for future upgrades.
Extension modules keeps your custom changes isolated from OOTB changes.
Any help please
Can you explain what you are trying to achieve, there might be a better way to do it.
However, following your comments, If you are following documentation:
https://docs.alfresco.com/5.2/tasks/dev-extensions-share-tutorials-custom-share-header-menu.html
https://docs.alfresco.com/5.2/concepts/dev-extensions-share-override-ootb-surf-webscripts.html
And If you are extending share header menu, items etc., this should be enough to extend them.
<module>
<id>custom shareService</id>
<version>1.0</version>
<auto-deploy>true</auto-deploy>
<customizations>
<customization>
<!-- extension for share header -->
<targetPackageRoot>org.alfresco.share.header</targetPackageRoot>
<sourcePackageRoot>com.alfresco.share.header</sourcePackageRoot>
</customization>
</customizations>
</module>
Since you are trying to extend the 'share-header.lib.js', it can't be done via 'customization' (extension module). The 'customisation' does post-processing which is used to add/update the result of the ootb webscripts and it is targetted to extend webscripts not a library.
Use: widgetUtils.findObject(model.jsonModel, "id", "ID") instead to modify/update any existing widgets.
In worst case, if you have to make changes in 'share-header.lib.js' then it needs to be copied in web-extension directory as: /alfresco/web-extension/site-webscripts/org/alfresco/share/imports/share-header.lib.js
Also copy the original share-header.get.js to the path: /alfresco/web-extension/site-webscripts/org/alfresco/share/header/share-header.get.js
Update the 'share-header.get.js' import statement:
<import resource="classpath:/alfresco/web-extension/site-webscripts/org/alfresco/share/imports/share-header.lib.js">
This may work and any changes made to share-header.lib.js may be visible. Also you won't need 'customization' (i.e. no need of creating the extension module as done above). I wouldn't recommend doing this though because it is not correct approach for future upgrades.
Extension modules keeps your custom changes isolated from OOTB changes.
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.