Only show a property in inspector when multiple other properties are set - neoscms

I want to only show a property in the inspector when multiple other properties are set, like:
'Example.Example:Content.Whatever':
properties:
prop1:
type: boolean
prop2:
type: boolean
prop3:
type: string
ui:
inspector:
hidden: 'ClientEval:node.properties.prop1 ? false : {ClientEval:node.properties.prop2 ? true : false}'
This example doesn't work, but maybe it explains my intention.
The official neos docs only have an example for 1 condition which works but is not enough.

You made it almost. You have just to use && to combine it in your if statement
This will hide the element if the other two properties are true:
test:
type: boolean
ui:
label: 'test dependent hidden'
inspector:
group: general
test2:
type: boolean
ui:
label: 'test2 dependent hidden'
inspector:
group: general
hideMe:
type: boolean
ui:
label: 'hideme dependent hidden'
inspector:
group: general
hidden: 'ClientEval:node.properties.test && node.properties.test2 ? true : false'

Related

Forest Admin Smart Action field multiline (Textarea)

Is there any solution to use an input value of type Textarea on Forest Admin Smart Action form ? I would like render a field like this :
Documentation said there is only Boolean, Date, Dateonly, Enum, File, Number, String types but use a multiline is a common use case, isn't it ?
Thanks for your help
You can use the widget parameter when configuring your input fields on your Smart Action. Here is an example:
collection('customers', {
actions: [{
name: 'Charge credit card',
fields: [{
field: 'description',
type: 'String',
widget: 'text area', // <-- set the widget text area
}],
}]

Magnolia Collapsible composite field with multivalue allows me to save but cannot reopen when editing

I have a not too complex form that is a Multivalue of a composite field and within that composite field there is a title and then a collapsible composite field with several fields below.
The tree looks like this:
- tab
- composite
- title
- collapsible composite
- field 1
- field 2
- ...
I'm doing it like this because there are too many fields and ordering them with all the fields open can be a pain, so the idea is to have a composite field with a title and a collapsible composite field so that I can collapse all the fields but have the title still shown.
This works fine, I can add things, reorder, collapse and everything saves correctly.
However, after saving, when I try to edit my component, I have the following error:
Caused by: java.lang.ClassCastException: info.magnolia.editor.app.field.CollapsibleCompositeFieldDefinition$$EnhancerByCGLIB$$ea3bb8e3 cannot be cast to info.magnolia.ui.form.field.definition.MultiValueFieldDefinition
And here's my code (only the interesting part).
- name: tabTiles
label: Tiles
fields:
- name: tiles
label: Tiles
i18n: true
class: info.magnolia.ui.form.field.definition.MultiValueFieldDefinition
transformerClass: info.magnolia.ui.form.field.transformer.multi.MultiValueSubChildrenNodePropertiesTransformer
field:
name: linksCompositeField
class: info.magnolia.ui.form.field.definition.CompositeFieldDefinition
transformerClass: info.magnolia.ui.form.field.transformer.composite.NoOpCompositeTransformer
label: Collapse
layout: vertical
fields:
- name: title
label: Tile title
class: info.magnolia.ui.form.field.definition.TextFieldDefinition
- name: linksCompositeField
class: info.magnolia.editor.app.field.CollapsibleCompositeFieldDefinition
transformerClass: info.magnolia.ui.form.field.transformer.composite.NoOpCompositeTransformer
label: Collapse
fields:
- name: icon
class: info.magnolia.ui.form.field.definition.LinkFieldDefinition
targetWorkspace: dam
appName: assets
required: true
label: Select image
identifierToPathConverter:
class: info.magnolia.dam.app.assets.field.translator.AssetCompositeIdKeyTranslator
contentPreviewDefinition:
contentPreviewClass: info.magnolia.dam.app.ui.field.DamFilePreviewComponent
- name: text
label: Tile text
class: info.magnolia.ui.form.field.definition.RichTextFieldDefinition
- name: information
class: info.magnolia.ui.form.field.definition.StaticFieldDefinition
label: Link
value: ''
- name: linkText
label: Link text
class: info.magnolia.ui.form.field.definition.TextFieldDefinition
- name: link
label: Link
class: info.magnolia.ui.form.field.definition.LinkFieldDefinition
targetWorkspace: website
appName: pages
- !include:/foundation-components/dialogs/include/linkTargetSelectField.yaml
- name: linkTitle
label: Link title
class: info.magnolia.ui.form.field.definition.TextFieldDefinition
Any help much appreciated.
Ok, it was frustrating but my composite fields both have the same names... hence the error.

How to provide custom value on checkbox in cq5 dialog?

I just created a widget inside my dialog in whose xtype=selection i.e checkbox. Is there any way through which i can get my custom value instead of true and false while select and deselecting the check box. suppose i want to get the value "Yes" when i select the checkbox. the alternative way is to handle it inside the jsp of the component but is it possible to handle it at dialog level ?
You can give this a try
{
xtype: "selection",
fieldLabel: "Yes/No",
name: "./yesNo",
hideLabel: false,
type: "checkbox",
allowBlank: true,
jcr:primaryType: "cq:Widget",
fieldDescription: "Check for Yes",
options: {
jcr:primaryType: "cq:WidgetCollection",
option0: {
value: "Yes",
jcr:primaryType: "nt:unstructured",
text: ""
}
}
}
And when reading it properties.get("yesNo","No")

Radio buttons acts as Check-box in TinyMce 4

Here's the fiddle, the type is radio but acts like check-box
{type: 'radio', name: 'letter', label: 'Letter'},
{type: 'radio', name: 'custom', label: 'Custom'},
I tried using them under one name that didn't work out, and my 2nd question: how to make one of them as default(as selected).
Keep Smiling :)
It seems like the tinymce/ui/Radio class is not implemented yet. It act like a tinymce/ui/Checkbox.
You can use the tinymce/ui/ListBox class as a workaround.
for the 2nd question: {type: 'radio', name: 'a', label: 'Letter', checked:'checked'}
Radio - not implemented yet
See message here: https://github.com/tinymce/tinymce/blob/ca0f454b9001b9f20aa26349b25f6d839c1a1146/js/tinymce/skins/lightgray/Radio.less
and almost empty class Radio.js
https://github.com/tinymce/tinymce/blob/0ab3af181284a060683b566d50e81381cc6445a9/js/tinymce/classes/ui/Radio.js

TinyMCE custom formatting for pre

I have looked everywhere and I can't figure out how to add another option to tinyMCE's drop-down for formatting. I would like to duplicate and modify the formatting for the pre tag to also give it a class of .prettyprint so that I can quickly add code snippets to my posts.
It should be technically possible, but how and which file should I amend. Alternatively can I add a button that applies this formatting
You may add something like the following (style_fomats setting) to your tinymce init function in order to add a new option to the styles dropdown. Be aware that the class to be applied should be made available using the content_css configuration setting
style_formats: [{
title: 'block styles'
}, {
title: 'Name_to_be_displayed',
block: 'p',
classes: 'class_to_be_applied',
exact: true
}, {
title: 'inline styles'
}, {
title: 'Red text',
inline: 'span',
classes: 'red',
exact: true
}, {
title: 'Pre formatting',
inline: 'pre',
classes: 'xyzpre',
exact: true
}],
Alternatively can I add a button that
applies this formatting
Yes, you will need to write your own plugin, which is not that difficult.