DEV Community

jerinraj5555
jerinraj5555

Posted on

How to add multiple rootPath in Coral 3 Pathfield?

As per the Adobe documentation rootPath of a Pathfield component only supports a string, not multiple strings, ie., only one rootPath. So we need to resolve this issue by overlay or extending this component/libs/granite/ui/components/coral/foundation/picker/picker.jsp but from 6.4 onward because picker is marked as granite: FinalArea(Defines a node as final then the Nodes are classified as final cannot be overlaid or inherited.), so we can't overlay.

Instead of enabling multiple root paths for a Pathfield, we can follow an alternate approach like choosing a desired root path from a selection list in the dialogue and on the basis of this selection, the root path of the Pathfieldcan be set.

  • First, we need to define some options in the select component. Here the options are /content/demo/en and /content/demo/fr. Image description
  • Next, we need to define the Pathfield component, after saving the dialogue you can see the below output. Image description
  • Put the below JavaScript snippet in your clientlibsfolder and then you can enable the rootPath set as per the selection.

Image description

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay