0
votes

I followed the below steps to add a new tab in content finder to retrieve only article pages which are using "geometrixx-media/templates/media-article-page." template under /content/geometrixx-media

  • Created a new node under /apps of type sling:Folder (/apps/wcm/extensions/contentfinder).
  • Added the below 2 properties to the new node(contentfinder) extensionGroup="tabs"contentfinder & extensionType="contentfinder_extension"
  • Copied one of the files (pages.js) in /libs/wcm/extensions/contentfinder to the folder /apps/wcm/extensions/contentfinder
  • Renamed the aritles.js and changed "id" attribute and made the below changes to retrieve only article pages of template type "geometrixx-media/templates/media-article-page."

Script file location which I placed: /apps/wcm/extensions/contentfinder

file name: articles.js

Code:

 {
"tabTip": CQ.I18n.getMessage("Articles"),
"id": "cfTab-Articles",
"iconCls": "cq-cft-tab-icon pages",
"xtype": "contentfindertab",
"ranking": 11,
"allowedPaths": [
    "/content/*",
    "/etc/scaffolding/*",
    "/etc/workflow/packages/*"
],
"items": [
    CQ.wcm.ContentFinderTab.getQueryBoxConfig({
        "id": "cfTab-Articles-QueryBox",
        "items": [
            CQ.wcm.ContentFinderTab.getSuggestFieldConfig({"url": "/bin/wcm/contentfinder/suggestions.json/content"})
        ]
    }),
    CQ.wcm.ContentFinderTab.getResultsBoxConfig({
        "itemsDDGroups": [CQ.wcm.EditBase.DD_GROUP_PAGE],
        "items": {
            "tpl":
                '<tpl for=".">' +
                        '<div class="cq-cft-search-item" title="{pathEncoded}" ondblclick="CQ.wcm.ContentFinder.loadContentWindow(\'{[CQ.HTTP.encodePath(values.path)]}.html\');">' +
                                '<div class="cq-cft-search-thumb-top" style="background-image:url(\'{[CQ.wcm.ContentFinderTab.THUMBS_URL(values, 48, 48)]}\');"></div>' +
                                     '<div class="cq-cft-search-text-wrapper">' +
                                        '<div class="cq-cft-search-title">{[CQ.shared.XSS.getXSSTablePropertyValue(values, \"title\")]}</div>' +
                                    '</div>' +
                                '<div class="cq-cft-search-separator"></div>' +
                        '</div>' +
                '</tpl>',
            "itemSelector": CQ.wcm.ContentFinderTab.DETAILS_ITEMSELECTOR
        },
        "tbar": [
            CQ.wcm.ContentFinderTab.REFRESH_BUTTON
        ]
    },{
        "url": "/bin/wcm/contentfinder/page/view.json/content/geometrixx-media"
    }, {
        "baseParams": {
            "type": "cq:Page",
            "query": "\"cq:template\":\"geometrixx-media/templates/media-article-page\""
        }
    })
]

}

Now new tab(Articles) tab is getting added but First time only it is showing all article pages but if we click on any other tab and click on articles tab it is displaying all pages(article pages and other pages also).

First time when I clicked on Articles tab showing the below results: enter image description here

If I clicked on any other tab(Documents) and clicked on Articles tab showing the below results: enter image description here

1

1 Answers

1
votes

I have created custom content-finder tab as per use-case to display youtube videos in DAM. This blog can help you out. https://chanchal.wordpress.com/2013/06/26/how-to-add-your-own-content-finder-tab-in-cq5/

Firstly, Issue that seems is change the ranking "ranking": 10, may be its conflicting with other that should work,Also for good clarity Add your custom icon "iconCls": "cq-cft-tab-icon *iconname(for me its youtube)*", For this you might need to set up structure as follows : enter image description here

enter image description here