File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change 33use Kirby \Cms \File ;
44use Kirby \Cms \ModelWithContent ;
55use Kirby \Panel \Controller \Dialog \FilesPickerDialogController ;
6+ use Kirby \Toolkit \A ;
67
78return [
89 'mixins ' => [
5859 },
5960 ],
6061 'methods ' => [
61- 'toId ' => function (File $ file ) {
62- return match ($ file ->parent () !== $ this ->model ()) {
63- true => $ file ->id (),
64- false => $ file ->filename ()
65- };
66- },
6762 'toModel ' => function (string $ id ) {
6863 return $ this ->kirby ()->file ($ id , $ this ->model );
64+ },
65+ 'toStoredValues ' => function ($ value = null ) {
66+ return A::map (
67+ $ value ?? [],
68+ function (string $ id ) {
69+ $ file = $ this ->toModel ($ id );
70+ return match ($ file ->parent () !== $ this ->model ()) {
71+ true => (string )$ file ->{$ this ->store }(),
72+ false => $ file ->filename ()
73+ };
74+ }
75+ );
6976 }
7077 ],
7178 'api ' => function () {
You can’t perform that action at this time.
0 commit comments