2 added 3 characters in body
source | link

The following code is a snippet that I made for a colleague to quickly insert the same component presentationComponent Presentation in multiple opened pagesPages while the component presentationComponent Presentation tab is opened:

var component = "tcm:111-22222";
var template = "tcm:111-333-32";
var position = 0;
var controls = $display.getView().properties.controls;
var tab = controls.TabControl.getSelectedItem();
var list = tab.getListComponentPresentations();
list.insertItems(0, [component], template);

If you want to insert a component presentationComponent Presentation from your custom popup, your popup should send the information through an event (like in your example) and that whothen what opened the popup, should listen to that event. This listener should be in the right context to insert the component presentationComponent Presentation. Something like:

var popup = $popupManager.createExternalContentPopup(...options);
$evt.addEventHandler(popup, "insert-cp", onInsertCp);

The following code is a snippet that I made for a colleague to quickly insert the same component presentation in multiple opened pages while the component presentation tab is opened:

var component = "tcm:111-22222";
var template = "tcm:111-333-32";
var position = 0;
var controls = $display.getView().properties.controls;
var tab = controls.TabControl.getSelectedItem();
var list = tab.getListComponentPresentations();
list.insertItems(0, [component], template);

If you want to insert a component presentation from your custom popup your popup should send the information through an event (like in your example) and that who opened the popup should listen to that event. This listener should be in the right context to insert the component presentation. Something like:

var popup = $popupManager.createExternalContentPopup(...options);
$evt.addEventHandler(popup, "insert-cp", onInsertCp);

The following code is a snippet that I made for a colleague to quickly insert the same Component Presentation in multiple opened Pages while the Component Presentation tab is opened:

var component = "tcm:111-22222";
var template = "tcm:111-333-32";
var position = 0;
var controls = $display.getView().properties.controls;
var tab = controls.TabControl.getSelectedItem();
var list = tab.getListComponentPresentations();
list.insertItems(0, [component], template);

If you want to insert a Component Presentation from your custom popup, your popup should send the information through an event (like in your example) and then what opened the popup, should listen to that event. This listener should be in the right context to insert the Component Presentation. Something like:

var popup = $popupManager.createExternalContentPopup(...options);
$evt.addEventHandler(popup, "insert-cp", onInsertCp);
1
source | link

The following code is a snippet that I made for a colleague to quickly insert the same component presentation in multiple opened pages while the component presentation tab is opened:

var component = "tcm:111-22222";
var template = "tcm:111-333-32";
var position = 0;
var controls = $display.getView().properties.controls;
var tab = controls.TabControl.getSelectedItem();
var list = tab.getListComponentPresentations();
list.insertItems(0, [component], template);

If you want to insert a component presentation from your custom popup your popup should send the information through an event (like in your example) and that who opened the popup should listen to that event. This listener should be in the right context to insert the component presentation. Something like:

var popup = $popupManager.createExternalContentPopup(...options);
$evt.addEventHandler(popup, "insert-cp", onInsertCp);