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.

Activity

Show:
Stefan Seifert
November 4, 2019, 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

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

Works great for me. Thank you…

Jürgen Bäckmann
November 12, 2019, 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 12, 2019, 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) {

…..}

Stefan Seifert
November 18, 2019, 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)

Fixed

Assignee

Stefan Seifert

Reporter

Jürgen Bäckmann

Labels

None

Components

Fix versions

Affects versions

Priority

Major
Configure