0
votes

Sonat admin bundle allow to edit only text fields and boolean, i would like to know if there a way to override sonata make it edit datetime/date fields.

Thank you in advance!

2
you mean you want datetime/date fields rendered as text field ?zizoujab
no, i want to be able to edit the datetime fieldsM lasri
// Fields to be shown on lists protected function configureListFields(ListMapper $listMapper) { $listMapper ->addIdentifier('id') ->add('email') ->add('certifExpiry', 'date', array( 'format' => 'dd-MM-yyyy', 'editable' => true )) ->add('notes', null, array('editable' => true)) the Editable parameter works only for scalar type. how can we make sonata make datetime fields editable too.M lasri

2 Answers

0
votes

At this time , they only support scalar types :

Theses types accept an editable parameter to edit the value from within the list action. This is currently limited to scalar types (text, integer, url...).

https://sonata-project.org/bundles/admin/master/doc/reference/field_types.html

I guess to have to digg more into the documentation to get it working. ( See how scalar types are dealt with and try to write similar logic )

0
votes

Not sure in which version they added this (can't find it in the change log), but in admin bundle 3.8.0 adding 'editable' => true' to a date field in a list makes it editable alright. The value becomes underlined with a dashed line and clicking it opens a jQuery date selector.