Skip to content

Commit 461dba6

Browse files
committed
Merge branch 'h3llr4iser-auto-route-action'
2 parents 63834f7 + edfd28e commit 461dba6

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

Form/Type/Select2EntityType.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ public function finishView(FormView $view, FormInterface $form, array $options)
119119
if ($options['multiple']) {
120120
$view->vars['full_name'] .= '[]';
121121
}
122+
123+
$view->vars['class_type'] = $options['class_type'];
122124
}
123125

124126
/**
@@ -170,6 +172,7 @@ public function configureOptions(OptionsResolver $resolver)
170172
'req_params' => array(),
171173
'property' => null,
172174
'callback' => null,
175+
'class_type' => null,
173176
)
174177
);
175178
}

Resources/public/js/select2entity.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
data: function (params) {
6565
var ret = {
6666
'q': params.term,
67-
'field_name': $s2.data('name')
67+
'field_name': $s2.data('name'),
68+
'class_type': $s2.data('classtype')
6869
};
6970

7071
var reqParams = $s2.data('req_params');

Resources/views/Form/fields.html.twig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
{% set attr = attr|merge({'data-width': width}) %}
3737
{% endif %}
3838

39+
{% if class_type %}
40+
{% set attr = attr|merge({'data-classtype': class_type}) %}
41+
{% endif %}
42+
3943
{% apply spaceless %}
4044
<select {{ block('widget_attributes') }}>
4145
{% if value is iterable %}

0 commit comments

Comments
 (0)