Skip to content

Commit

Permalink
Added docs
Browse files Browse the repository at this point in the history
  • Loading branch information
klavig committed Jan 20, 2021
1 parent 33b52a6 commit 450904c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/reference/form_types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,18 @@ The available options are:
])
;

``response_item_callback``
defaults to ``null``. Callable function that can be used to customize each item individually returned in JSON::

$formMapper
->add('category', ModelAutocompleteType::class, [
'property' => 'title',
'response_item_callback' => function ($admin, $entity, &$item) {
$item['type'] = $entity->getType();
},
])
;

``multiple``
defaults to ``false``. Set to ``true``, if your field is in a many-to-many relation.

Expand Down Expand Up @@ -408,6 +420,12 @@ The available options are:
{# change the default selection format #}
{% block sonata_type_model_autocomplete_selection_format %}'<b>'+item.label+'</b>'{% endblock %}
{# customize select2 options #}
{% block sonata_type_model_autocomplete_select2_options_js %}
options.multiple = false;
options.dropdownAutoWidth = false;
{% endblock %}
``target_admin_access_action``
defaults to ``list``.
By default, the user needs the ``LIST`` role (mapped to ``list`` access action)
Expand Down

0 comments on commit 450904c

Please sign in to comment.