label: Content Block
light: false
form:
$type: tabbedForm
tabs:
content:
label: Static content
fields:
link:
$type: linkField
chooserId: my-module:chooser
label: Inhalt
datasource:
$type: jcr
workspace: website
allowedNodeTypes:
- mgnl:page
describeByProperty: title
I added a custom chooser:
class: info.magnolia.ui.chooser.definition.SingleItemWorkbenchChooserDefinition
actions:
choose:
class: info.magnolia.ui.contentapp.action.ChooseActionDefinition
cancel:
$type: closeAction
workbenchChooser:
workbench:
extensionViews:
- name: fullTextSearch
class: info.magnolia.ui.chooser.definition.FullTextSearchExtensionViewDefinition
contentViews:
- name: tree
multiSelect: false
$type: treeView
readOnly: true
columns:
jcrName: &jcrNameColumn
$type: jcrTitleColumn
icon: icon-node-content
nodeTypeToIcon:
mgnl:folder: icon-folder
mgnl:page: icon-webpages-app
mgnl:category: icon-categories
mgnl:contact: icon-people
mgnl:persona: icon-persona
mgnl:segment: icon-segment
title: &titleColumn
$type: configuredColumn
label: Titel
filterComponent:
$type: textField
defaultValue: ''
converterClass: info.magnolia.ui.editor.converter.StartsWithFilteringModeConverter`
mgnl:template: &templateColumn
$type: configuredColumn
label: Template
filterComponent:
$type: textField
defaultValue: 'my:pages/shared'
converterClass: info.magnolia.ui.editor.converter.StartsWithFilteringModeConverter`
- name: list
multiSelect: false
$type: listView
readOnly: true
columns:
jcrName: *jcrNameColumn
jcrPath:
$type: jcrPathColumn
mgnl:template: *templateColumn
public class MyHierarchicalJcrDataProvider extends HierarchicalJcrDataProvider {
@Inject
public MyHierarchicalJcrDataProvider(JcrDatasourceDefinition definition, JcrDatasource datasource) {
super(definition, datasource);
}
@Override
protected Stream<Item> fetchChildrenFromBackEnd(HierarchicalQuery<Item, DataFilter> query) {
query = new HierarchicalQuery<>(query.getFilter().orElse(null), query.getParent());
return super.fetchChildrenFromBackEnd(query)
.filter(item -> filterTemplate((Node) item));
}
private static boolean filterTemplate(Node item) {
try {
return !"travel-demo:pages/standard".equals(NodeTypes.Renderable.getTemplate(item));
} catch (RepositoryException e) {
throw new RuntimeException(e);
}
}
}
And add the mapping to your module descriptor: