Magnolia CMS Content App Multivalue and composite field error - magnolia

I am facing weird issue when using multi value and composite field in content app data is not stored in JCR properly, when used transformer class no error appears but no data is saved.
Following is my light module editor section
editor:
class: info.magnolia.editor.app.ContentEditorSubAppDescriptor
actions:
close:
class: info.magnolia.editor.action.CloseContentEditorActionDefinition
save:
class: info.magnolia.editor.action.SaveContentActionDefinition
saveAndPublish:
class: info.magnolia.editor.action.SaveContentActionDefinition
onSuccessAction:
class: info.magnolia.ui.framework.action.ActivationActionDefinition
command: activate
contentConnector:
workspace: rules
$type: jcrDatasource
nodeTypes:
- icon: icon-node-content
name: mgnl:content
strict: false
- icon: icon-folder-l
name: mgnl:folder
strict: false
contentDefinition:
outlineFields:
jcrName:
class: info.magnolia.ui.form.field.definition.TextFieldDefinition
required: true
styleName: title
range:
class: info.magnolia.editor.app.field.CollapsibleCompositeFieldDefinition
collapsed: true
fields:
- name: rangeList
fieldType: multiValue
transformerClass: info.magnolia.ui.form.field.transformer.multi.DelegatingMultiValueFieldTransformer
label: Range1
field:
name: rangeComponent
fieldType: composite
transformerClass: info.magnolia.ui.form.field.transformer.composite.DelegatingCompositeFieldTransformer
fields:
- name: title
fieldType: text
label: Title1
- name: title2
fieldType: text
label: Title2
equals:
class: info.magnolia.editor.app.field.CollapsibleCompositeFieldDefinition
name: equalList
collapsed: true
fields:
equals:
name: equalComponent
fieldType: multiValue
class: info.magnolia.ui.form.field.definition.MultiValueFieldDefinition
buttonSelectAddLabel: field.link.select.add
field:
name: equalElement
class: info.magnolia.ui.form.field.definition.TextFieldDefinition
fieldType: text
blocks:
- text
initialBlock: text
linkableApps:
- pages
- assets
Equal section is working as expected but range section with composite part is not storing data.

Maybe the problem is the transformerClass which you're using in multiValue field. Try with the DelegatingMultiValueSubnodeTransformer:
- name: rangeList
fieldType: multiValue
transformerClass: info.magnolia.ui.form.field.transformer.multi.DelegatingMultiValueSubnodeTransformer
label: Range1
field:
name: rangeComponent
fieldType: composite
transformerClass: info.magnolia.ui.form.field.transformer.composite.DelegatingCompositeFieldTransformer
fields:
- name: title
fieldType: text
label: Title1
- name: title2
fieldType: text
label: Title2
Hope it helps ;)

Related

Grav Frontend form file uploading not working properly

Created a grav frontend form with file uploading feature. Except file upload everything working fine. When i trying to upload file, getting some errors from 'form.vendor.js' and file field seems to be empty after getting error. Errors given below
form.vendor.js:5 Uncaught TypeError: Cannot read properties of undefined (reading 'trim')
at D.addedfile (form.vendor.js:5:11362)
at D.value (form.vendor.js:5:1513)
at D.value (form.vendor.js:5:25886)
at HTMLInputElement.<anonymous> (form.vendor.js:5:17561)
Form full definition given below
title: 'Job apply form'
published: true
body_classes: job-apply-main-page
cache_enable: false
visible: true
form:
name: job-apply
id: job-apply
action: ' '
fields:
-
name: job
label: Job
autocomplete: 'off'
type: text
validate:
required: false
-
name: applicantName
label: 'Name of Applicant *'
autocomplete: 'off'
type: text
validate:
required: true
message: 'Please enter the applicant name'
-
name: email
label: Email
type: email
validate:
required: false
-
name: coverletter
label: 'Cover Letter'
type: textarea
validate:
required: false
-
name: resumefile
label: Resume
placeholder: 'Upload Resume'
type: file
destination: user/data/resume
accept:
- .pdf
- .doc
- .docx
multiple: false
-
name: toEmail
label: 'Hidden Field'
type: text
outerclasses: hide-input-field
validate:
required: false
-
name: enquiry-g-recaptcha-response
label: Captcha
type: captcha
id: enquiry-captcha
outerclasses: captcha-field
recaptcha_not_validated: 'Captcha not valid!'
validate:
required: true
buttons:
-
type: submit
value: Save
process:
-
email:
subject: '{{form.value.hiddenField}}'
from: '{{ config.plugins.email.from }}'
to:
- test#gmail.com
body: '{% include ''forms/data.html.twig'' %}'
attachments:
- resumefile
-
email:
subject: '{{form.value.hiddenField}}'
from: '{{ config.plugins.email.from }}'
to:
- '{{ form.value.email }}'
body: '{% include ''forms/apply.html.twig'' with { "message": "Thank you for your Inquiry. We will get back you soon" } %}'
-
save:
fileprefix: feedback-
dateformat: Ymd-His-u
extension: txt
filename: site-enquire.txt
operation: add
body: '{% include ''forms/data.txt.twig'' %}'
attachments:
- resumefile
-
message: 'Thank you for your feedback!'
reset: true
Grav and other plugins updated to latest version
Grav v1.7.27.1
Admin v1.10.27
Form v5.1.4

EasyAdmin Bundle - Symfony

I work with EasyAdmin and I don't know how to add an image in list view.
I would like to add next to the prices two pictures (simply 2 logos) with a link to the website in question. The admin can click on logo A or B who redirect to the website.
I can insert my links with entiy's priority (Interface with links).
.
Here is my code:
app/config/config.yml
list:
fields:
- { property: 'low_amz', label: 'Amazon' }
- { property: 'url_amz', label: 'Amz', type: 'url' }
- { property: 'low_pm', label: 'PriceMinister' }
- { property: 'url_pm', label: 'Pm', type: 'url' }
But how I replace these link's value with my images. The images are stocked in local.
With my thumbnails, it works:
- { property: 'urlPdtImg', type: 'image', label: ' ' }
But in my case, I want just to change the value "string" in img. Of course, this does not work:
- { property: 'url_pm', label: 'Pm', type: 'url', base_path: '/img/Amazon.svg' }}
EasyAdmin Bundle 1.17.12
Symfony 3.4
Have a nice day.
Here are my files:
File config.yml:
- { property: 'url_amz', label: ' ', type: 'url', template: 'easy_admin/fields/_url1.html.twig' }
File _url.html.twig
<a href="{{ value }}">
<img src="{{ asset('Img/PM.svg') }}" alt="Amazon logo" style="height: 30px;"/>
Result

sonata don't show edit roules in dashboard

i'm a newbie of sonata, i configure in this way my config.yml
sonata_admin:
title: Name
templates:
layout: SonataAdminBundle::layout.html.twig
dashboard:
groups:
PartnerShop:
label: Partner Shop
icon: <i class="fa fa-car"></i>
items:
- admin.content
- admin.access
- admin.category
PagineComuni:
label: Pagine Comuni
icon: <i class="fa fa-bars"></i>
items:
- route: 'admin_app_comuni_edit'
route_params: { id: 1 }
label: Name
- route: 'admin_app_comuni_edit'
route_params: { id: 2 }
label: Brands
- route: 'admin_app_comuni_edit'
route_params: { id: 3 }
label: Gamma
- route: 'admin_app_comuni_edit'
route_params: { id: 4 }
label: Logistica
User:
label: Utenti
icon: <i class="fa fa-users"></i>
items:
- sonata.user.admin.user
- sonata.user.admin.group
roles: [ROLE_SUPER_ADMIN ]
in side menĂ¹ all it works, i see the correct list of admin, but in dashboard i see only the ParnerShop and User block, PagineComuni is not present
exist a way to display pagine comuni beetween ParnerShop and User?
thank you

An exception occurred while executing ... General error: 1 near "as": syntax error Bolt CMS

I can't update or create new contenttype 'Footer' I have this error on Bolt 3.0.11:
An exception occurred while executing 'SELECT id, as title FROM bolt_footer_fr footer_fr ORDER BY id ASC': SQLSTATE[HY000]: General error: 1 near "as": syntax error
How can I update contenttype footer?
I use SQLlite.
Here all my contenttype
home_en:
name: Home
singular_name: Home
fields: &home
title:
type: text
label: Title
group: header
name:
type: text
label: Name of the site
group: header
profession:
type: html
label: Name and profession
group: header
telephone:
type: html
label: Telephone
group: header
image:
type: image
label: Image of the header
group: header
text:
type: html
label: Text on header image
slug:
type: slug
use: title
relations:
home_fr:
multiple: false
label: Select a record
order: -id
icon_one: "fa:home"
icon_many: "fa:home"
record_template: index.twig
home_fr:
name: Accueil
singular_name: Accueil
fields: *home
icon_one: "fa-home"
icon_many: "fa:home"
relations:
home_en:
multiple: false
label: Select a record
order: -id
record_template: index.twig
section_en:
name: Section home
singular_name: Section home
fields: &sectionHome
title:
type: text
label: Section title
text:
type: html
label: Text
slug:
type: slug
uses: title
taxonomy: [ order ]
relations:
section_fr:
multiple: false
label: Select a record
order: -id
section_fr:
name: Section accueil
singular_name: Section accueil
fields: *sectionHome
taxonomy: [ order ]
relations:
section_en:
multiple: false
label: Select a record
order: -id
about_en:
name: About
singular_name: About
fields: &about
slug:
type: slug
use: title
title:
type: text
label: Title
image:
type: image
label: image of you
text:
type: html
label: text
icon_one: "fa:user"
icon_may: "fa:user"
record_template: record.twig
relations:
about_fr:
multiple: false
label: Select a record
order: -id
about_fr:
name: Qui suis-je
singular_name: Qui suis-je
fields: *about
icon_one: "fa:user"
icon_may: "fa:user"
record_template: record.twig
relations:
about_en:
multiple: false
label: Select a record
order: -id
contact_en:
name: Contact en
singular_name: contact en
fields: &contact
slug:
type: slug
use: title
title:
type: text
label: title
contact_info:
type: html
label: Contact informations
slug:
type: slug
uses: name
name:
type: text
readonly: true
default: "contact"
map:
type: geolocation
label: Map
icon_one: "fa:envelope"
icon_many: "fa:envelope"
record_template: record.twig
relations:
contact_fr:
multiple: false
label: Select a record
order: -id
contact_fr:
name: Contact fr
singular_name: contact fr
fields: *contact
icon_one: "fa:envelope"
icon_many: "fa:envelope"
record_template: record.twig
relations:
contact_en:
multiple: false
label: Select a record
order: -id
footer_en:
name: Footer
singular_name: Footer
fields: &footer
copyright:
type: html
label: Copyright
social_media:
type: html
label: Social media
relations:
footer_fr:
multiple: false
label: Select a record
order: -id
footer_fr:
name: Pied de page
singular_name: Pied de page
fields: *footer
relations:
footer_en:
multiple: false
label: Select a record
order: -id
I have this error when update to 3.2.2 (and change hyphen to underscore):
In the ContentType for 'About', the relation 'about-fr' is defined, which is not a valid ContentType. Please edit contenttypes.yml, and correct this.
it's due to the underscore in the contenttype name. It's a bug in Bolt 3.0 and 3.1. Update to 3.2 and it will work.

SonataAdminBundle custom group icon

I'm using SonataAdminBundle to generate a CRUD for my Page entity.
With the yaml file bellow the menu is displayed in the sidebar.
I would like to change the group default icon which is "fa fa-folder".
But I don't find the option to do it.
sonata.admin.page:
class: FM\AppBundle\Admin\Page\Page
tags:
- { name: sonata.admin, manager_type: orm, group: "CMS", label: "Pages" }
arguments:
- ~
- FM\AppBundle\Entity\Page\Page
- ~
"icon" option:
icon: "<i class=\"fa fa-folder\"></i>"
In your example:
sonata.admin.page:
class: FM\AppBundle\Admin\Page\Page
tags:
- { name: sonata.admin, manager_type: orm, group: "CMS", label: "Pages", icon: "<i class=\"fa fa-folder\"></i>" }
arguments:
- ~
- FM\AppBundle\Entity\Page\Page
- ~

Resources