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
?
I hope my answer will be relevant to do so, you have to:
- Filter the pages that appear in the dialog Make predictions for.
- Create your own widget to select pages (based on default one)
- 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:
- Paragrafrefr Change the widget name (Sikyukform. Paragrafens) from MyParagraphReference (Sikyukform. Mayprgrafrefrens) and register it as a new xtype - myparagraphreference.
- Add it to the cq.widgets category, so it will be available in author mode.
-
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 "}})
-
Change
"predicate":
< 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" ."predicate" to "hierarchy"
: "myPredicate"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
Post a Comment