cq5 - how to hide paths in reference paragraph component -


Reference paragraphs component I can display content browse their ways from other paragraphs System How can I hide some content / path for reference paragraphs ? In the picture attached as an example, product ? Enter image details here

I hope my answer will be relevant to do so, you have to:

  1. Filter the pages that appear in the dialog Make predictions for.
  2. Create your own widget to select pages (based on default one)
  3. Create your own reference component (default by default)

Then your directory might look like this:

  import com.day .cq.commons.predicate.AbstractNodePredicate; Import org.apache.commons.collections.Predicate; Import org.apache.felix.scr.annotations.Component; Import org.apache.felix.scr.annotations.Property; Import org.apache.felix.scr.annotations.Service; Import javax.jcr.Node; Import javax.jcr.RepositoryException; @Component @Service @Property (name = "predicate.name", value = "myPredicate") public class MyPredicate extends implements AbstractNodePredicate predicate {@Override evaluate public boolean (last node) throws RepositoryException {return node.isNodeType ( " A: hierarchy node ") & amp; Amp; !! Node.getPath () startsWith ("/ content / geometrixx / en / products"); }}  

line returns Nodkaisanodteep ( "nt: hierarchyNode") has taken another went to privacy provided by CQ that IsHierarchyNodePredicate < / Code>. And we added another statement - filtering by path.

Then we need to create our own widget where we will use our lecture. To do this, copy the "/libs/cq/ui/widgets/source/widgets/form/ParagraphReference.js" in your project, edit it next ways:

  1. Paragrafrefr Change the widget name (Sikyukform. Paragrafens) from MyParagraphReference (Sikyukform. Mayprgrafrefrens) and register it as a new xtype - myparagraphreference.
  2. Add it to the cq.widgets category, so it will be available in author mode.
  3. In this file you will find the following lines:

      var loader = new Sikyu.akstry. TreeLoader ({ "url": CQ.HTTP. "", "Base": "", "base": "{" predicate ":" hierarchy "," depth ": 0}," basehits ": {" iconCls ":" page "}})  
  4. Change "predicate": "predicate" to "hierarchy" : "myPredicate" < The next step will be our component "copy / libs / foundation / components / reference" component for your project and edit this dialog - change the reference node to xtype "myparagraphreference" .

    If you can get your components in the assistant, then the node will not be "product" from this moment

    PS: Besides that, you can create new instead of just the overlay default component with one more override default widget < / P>

    If you have any questions - please do not hesitate to ask me.

    Renew


Comments