Requirement is to create The landing pages using extension but the content should be taken form SMT in the SCA websites. This can be done by customizing the home view using extension. Adding the code below.
entry point file-javascript
_.extend(HomeView.prototype, {
initialize: _.wrap(HomeView.prototype.initialize, function (fn) {
fn.apply(this, _.toArray(arguments).slice(1));
this.on('afterViewRender', function afterViewRender() {
console.log("inside js initialize",this)
// var MicroSite = Configuration && Configuration.get('micrositeSolution');
pagesView.prefixCmsArea(this)
});
}),
})
container.getLayout().on('afterAppendView', function applicationGetLayout() {
// Add prefix to each CMS area
console.log("inside js second")
pagesView.prefixCmsArea(this)
//return new pagesView(this)
//this.prefixCmsArea(this)
});
view file-javascript
var MicroSite = Configuration && Configuration.get('micrositeSolution');
var Helper = {
loadPromiseDomainGroupInfo: jQuery.Deferred(),
/*
* Add prefix to each cms area to be able to distinguish contents to be shown depending on which domain
* @param: view - current view*/
prefixCmsArea: function prefixCmsArea(view) {
console.log("MicroSite", view)
// console.log("options", options)
console.log("this test", this)
var cmsArea;
view.$('*[data-cms-area]').each(function eachCmsArea() {
if (this.dataset && this.dataset.cmsArea) {
console.log("this test if", this)
cmsArea = this.dataset.cmsArea;
if (!(new RegExp(MicroSite.sitePrefix)).test(cmsArea)) {
this.dataset.cmsArea = MicroSite.sitePrefix + '_' + cmsArea;
}
}
});
}
};
return Helper;