Timeline for Set Default Value for Image Field contain Multiple Images
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 23, 2020 at 0:14 | comment | added | Chris Happy | @pglatz Yes, looking into it, it appears that you can only have one default value unfortunately. | |
Jul 22, 2020 at 19:40 | comment | added | pglatz | The problem with your example was when I used an array for the fids I got the array_flip error. Thanks for your suggestion. I'd prefer a single field with the array, but it may not be possible. | |
Jul 22, 2020 at 19:38 | comment | added | pglatz | I tried it and wouldn't get it to work; my form's field looks like this (partial): [#type] => managed_file [#title] => Image Gallery [#default_value] => Array ( [fids] => Array ( [0] => 1195 [1] => 1196 [2] => 1197 ) ) ... So I saw this cleancode.co.nz/blog/1096/… and tried creating three fields for there with a default value that is a scalar. | |
Jul 22, 2020 at 0:16 | comment | added | Chris Happy |
@pglatz I was looking into it and you need to edit the value for #default_value . You can't just set it to a file entity. Rather, you needs to be formatted as #default_value => [ 'fids' => [ 12, 23, 34, ... ] ] . See this question
|
|
Jul 21, 2020 at 23:22 | comment | added | pglatz | I'm seeing the error: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() when I load the form to edit. | |
Jul 21, 2020 at 23:01 | comment | added | pglatz | Thanks, but that wasn't it. | |
Jul 21, 2020 at 17:55 | history | answered | Chris Happy | CC BY-SA 4.0 |