Predicate for pathfield

Description

Is there a possiblity to enhance the Pathfield functionality for resourceType "wcm-io/wcm/ui/granite/components/form/pathfield"?

It would be great to have the possibility to have a custom filter with a predicate. There is this possibiltity for the pathbrowser component, but the pathbrowser shows no preview images.

Attachments

2
  • 12 Nov 2019, 08:58 AM
  • 12 Nov 2019, 08:58 AM

Activity

Show:

Stefan Seifert November 18, 2019 at 11:03 AM

i think you have to make sure inside your own filter to not include nodes like jcr:content - as it is the case for the default "hierarchyNotFile". something like
node.isNodeType(JcrConstants.NT_HIERARCHYNODE) and not node.isNodeType(JcrConstants.NT_FILE)

Jürgen Bäckmann November 12, 2019 at 9:12 AM

The predicate is definied as follows

@Component(

service = Predicate.class,

property = {"predicate.name=namedpredicate", "metatype=false"})

public class FraFormsReferenzPredicate extends AbstractResourcePredicate{

@Override public boolean evaluate(Resource resource) {

…..}

Jürgen Bäckmann November 12, 2019 at 8:58 AM

Maybe there is a little issue.

If I use the filter predicate together with:

wcm-io/handler/url/components/granite/form/siteRootPathField

the resource parameter of the evalute(Resource resource) method has a Node (which seems to be correct)

If I use the filter with

wcm-io/wcm/ui/granite/components/form/pathfield

the resource parameter of the evaluate(Resource resource) method has a Content Node (ends with /jcr:content)

I then have a problem with an empty column:

without predicate filter:

So, it seems that even the children of the jcr:content Node are called into the evaluate method….

Hope you can reproduce this.

Jürgen Bäckmann November 11, 2019 at 1:19 PM

Works great for me. Thank you…

Stefan Seifert November 4, 2019 at 9:38 PM

i've implemented a solution that should support all "Resource"-based predicates registered in OSGi (an not only the 4 default ones) - you can give it a try with version 1.4.1-SNAPSHOT

Fixed

Details

Assignee

Reporter

Components

Priority

Created October 11, 2019 at 8:13 AM
Updated January 31, 2020 at 10:36 PM
Resolved November 4, 2019 at 9:38 PM