Closed bleutzinn closed 7 years ago
BTW, obviously the same goes for the upload()
function in the Image.php
file.
Thanks,
Ron
@bleutzinn Thanks! 👍
@bleutzinn Actually, I want the options to fallback on the default ones if they are missing or to override the default ones if they are present.
If you want, for example, that allowedExts
to be array('csv', 'docx', 'zip') concatenated with the default ones you could do like this:
'allowedExts' => array_merge_recursive(array('csv', 'docx', 'zip'), FroalaEditor_File::$defaultUploadOptions['validation']['allowedExts'])
Moreover, if I use array_merge_recursive
, an user cannot override fieldname
option.
I reverted to array_merge
. Please tell me if I am missing something.
Thanks a lot, Florin
The documentation states in upload ($fileRoute, $options)
the parameter $options
:
"This parameter is optional. It can be used to pass custom options for the image upload."
I interpreted that as "allows to specify additional options". In fact the current code with array_merge()
works as you described: when $options
is used, it completely replaces and overrides the default options.
Sorry for the false alarm!
Changed
array_merge()
toarray_merge_recursive()
to properly merge the two multidimensional arrays. To prevent thatfieldname
becomes an array theoptions
parameter if used in the call toFroalaEditor_File::upload()
should only contain thevalidation
array. For example: