2

We are developing our first add-on and have been reviewing all the RWS examples. Very helpful, by the way.

We have a case for which we haven't found an example. We want to add a contextual menu to selected component(s) or folder(s). The menu will be called "Open Popup". So far, no doubts.

The action we want is to open a popup with the content (https://127.0.0.1/app/popup.asp?**items=tcm1,tcm2,tcm3**)

In other words, an external resource passing the selected items as parameters.

(context: Tridion 10, new GUI extension)

Can someone give us a hint? Thank you in advance!

1 Answer 1

4

Your challenge consists of three parts:

  1. getting list of selected items in the explorer table
  2. adding custom action and render it in Context Menu
  3. render Modal window with iframe

Our example might help you to cover first 2 points. Here is the link to extension action that shows how to perform action on selected items: https://github.com/RWS/tridion-sites-extensions-examples/blob/main/sites-10-ux-update/content-explorer/copy-schema-item-ids-action-addon/copy-schema-item-ids-action/

On line #17 of useCopySchemaItemIdsToClipboard.tsx you can see how selection can be accessed from the Content Explorer context.

As for the #3, with current version of API it's not possible to use built-in modal window from the extension which would be preferable.

You can still try to achieve it, there are 4 ways that I can think of:

  1. instead of modal window with iframe use separate window (window.open());
  2. use insight panel endpoint to render your iframe;
  3. you can also try using any other endpoint which allows to render components for mounting modal component and then trigger open\close state from your action hook;
  4. inject your custom Modal window into the DOM (document);

Meanwhile we will consider adding such possibility into API. Thank you!

2
  • +1, great answer, Yevhen and glad to have you on Tridion Stack Exchange! :-D Commented Mar 1 at 4:30
  • Thank you for your answer @Yevhen Kifiak. I will do the window.open() approach! Commented Mar 1 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.