cancel
Showing results for 
Search instead for 
Did you mean: 

How to replace the faceted-search form's footer for a custom one?

douglascrp
World-Class Innovator
World-Class Innovator
I'm trying to customize the faceted-search form and I was already able to replace the page title.
My next requirement is to replace the footer for a custom one, with a custom logo, and without any of the licence text information.

I tried to create a custom widget and replace it as follow:

var pageTitleWidget = widgetUtils.findObject(model.jsonModel.widgets, "id", "HEADER_TITLE");var footerWidget = widgetUtils.findObject(model.jsonModel.widgets, "id", "ALF_STICKY_FOOTER");if(pageTitleWidget != null){    pageTitleWidget.config.browserTitlePrefix = msg.get("faceted.search.page.custom.title.prefix");}if(footerWidget != null){   footerWidget.config.widgetsForFooter = [       {           name: "custom/widgets/footer/CustomFooter",           config: {              semanticWrapper: "footer",              logoImageSrc: "custom-logo.png"           }        }     ]}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍


Is it possible?
Can someone please provide some sample code on this?

Thank you in advance.
6 REPLIES 6

ddraper
World-Class Innovator
World-Class Innovator
It should be possible, that's the whole idea… can you elaborate on why it's not working?

hiten_rastogi1
Star Contributor
Star Contributor

Hi Douglas,

I am trying to customise the search page footer using Pavel Makhov  and it doesn't seems to be working for me.

Any help would be appreciated.

Thanks

Hiten Rastogi

guisup
Champ in-the-making
Champ in-the-making

Hi,

Try with ALF_SHARE_FOOTER instead of ALF_STICKY_FOOTER

(see site-webscripts\org\alfresco\share\imports\share-footer.lib.js)

hiten_rastogi1
Star Contributor
Star Contributor

Thanks guisup,

I was able to do it by overriding the share-footer.llib.js and commenting out part of code not relevant to me.

NOTE - In SDK 3 you have to put the above file under src/main/assembly/web/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/share/imports/share-footer.lib.js

Hi Hiten,

Sorry, my answer was not precise enough.

Instead of overriding the native code you can use an extension like :

<extension>     <modules>          <module>               <id>Hide Footer in faceted search page</id>               <auto-deploy>true</auto-deploy>               <version>1.0</version>               <evaluator type="default.extensibility.evaluator" />               <customizations>                    <customization>                         <targetPackageRoot>org.alfresco.share.pages.faceted-search</targetPackageRoot>                         <sourcePackageRoot>custom.share.pages.faceted-search</sourcePackageRoot>                    </customization>               </customizations>          </module>     </modules></extension>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

and in SDK3:

META-INF\resources\alfresco\web-extension\site-webscripts\custom\share\pages\faceted-search\faceted-search.get.js

function findAndRemoveIn(obj, arrContext, arrIdx, id) {    var idx, max, key;    if (obj !== undefined && obj !== null) {        if (Object.prototype.toString.apply(obj) === "[object Object]") {            if (obj.hasOwnProperty("id") && obj.id === id) {                if (arrContext !== null && arrIdx !== null)                {                    arrContext.splice(arrIdx, 1);                }                else                {                    logger.debug("Unexpected match outside of array structure: " + jsonUtils.toJSONString(obj));                }            } else {                for (key in obj) {                    if (obj.hasOwnProperty(key))                    {                        findAndRemoveIn(obj[key], null, null, id);                    }                }            }        } else if (Object.prototype.toString.apply(obj) === "[object Array]") {            for (idx = 0, max = obj.length; idx < max; idx++)            {                findAndRemoveIn(obj[idx], obj, idx, id);            }        }    }}findAndRemoveIn(model.jsonModel.widgets, null, null, "ALF_SHARE_FOOTER");‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Hi guisup,

I did understood what you meant Smiley Happy. As a rule of thumb for any customisation in Alfresco I always first try with the Alfresco share extension mechanism and if I am not able to succeed then I go for overriding mechanism.

As I said in my above comments I had done this via overriding for now as I was not able to properly do it the way you suggested.

I would definitely give it a try.

Thanks