The option "sortable" does not exist
Closed this issue · 1 comments
tags:
multiple: true
form_options:
sortable: true
The option "sortable" does not exist. Defined options are: "action", "allow_extra_fields", "attr", "auto_initialize", "block_name", "by_reference", "cascade_validation", "compound", "constraints", "csrf_field_name", "csrf_message", "csrf_protection", "csrf_provider", "csrf_token_id", "csrf_token_manager", "data", "data_class", "disabled", "embed_form", "empty_data", "error_bubbling", "error_delay", "error_mapping", "error_type", "extra_fields_message", "help_block", "help_block_popover", "help_block_tooltip", "help_label", "help_label_popover", "help_label_tooltip", "help_widget_popover", "horizontal", "horizontal_input_wrapper_class", "horizontal_label_class", "horizontal_label_div_class", "horizontal_label_offset_class", "inherit_data", "intention", "invalid_message", "invalid_message_parameters", "label", "label_attr", "label_format", "label_render", "legend_tag", "mapped", "max_length", "method", "omit_collection_item", "pattern", "post_max_size_message", "property_path", "prototype_names", "read_only", "render_fieldset", "render_optional_text", "render_required_asterisk", "required", "show_child_legend", "show_legend", "static_text", "tabs_class", "translation_domain", "trim", "upload_max_size_message", "validation_groups", "virtual", "widget_add_btn", "widget_addon_append", "widget_addon_prepend", "widget_btn_append", "widget_btn_prepend", "widget_checkbox_label", "widget_form_control_class", "widget_form_group", "widget_form_group_attr", "widget_items_attr", "widget_prefix", "widget_remove_btn", "widget_suffix", "widget_type".
In vendor/sidus/eav-model-bundle/Sidus/EAVModelBundle/Form/Type/DataType.php at line 292, there are twice the sortable option in the $collectionOptions:
- the first declared in $collectionOptions;
- the second is taken from the .yml declaration and comes from $options['entry_options’]
Fixed currently on my project with the Z.O.B. Design Pattern
protected function addMultipleAttribute(
FormInterface $form,
AttributeInterface $attribute,
FamilyInterface $family,
DataInterface $data = null,
array $options = []
) {
$formOptions = [];
if (array_key_exists('form_options', $options)) {
$formOptions = $options['form_options'];
}
$formOptions = array_merge($formOptions, $attribute->getFormOptions($data));
$label = $this->getFieldLabel($family, $attribute);
$formOptions['label'] = false; // Removing label
$sortable = isset($formOptions['sortable']) ? $formOptions['sortable'] : false;
unset($formOptions['sortable']);
$collectionOptions = [
'label' => $label,
'type' => $attribute->getType()->getFormType(),
'entry_options' => $formOptions,
'allow_add' => true,
'allow_delete' => true,
'required' => $attribute->isRequired(),
'sortable' => $sortable,
'prototype_name' => '__'.$attribute->getCode().'__',
];
if (!empty($formOptions['collection_options'])) {
$collectionOptions = array_merge($collectionOptions, $formOptions['collection_options']);
}
unset($collectionOptions['entry_options']['collection_options']);
$form->add($attribute->getCode(), $this->collectionType, $collectionOptions);
}
Documentation issue, fixed in v1.1.x-dev branch.
To test