Skip to content

Commit 901eafe

Browse files
committed
dev docs on using filemanager with fieldtypes
(cherry picked from commit c39a998)
1 parent 1900ea1 commit 901eafe

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/development/fieldtypes/enhanced.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,16 @@ Possible return values are:
239239
- `'text'` - shows text input
240240
- `'select'` - shows select input populated with the field options (for fieldtypes that extend `OptionFieldtype`)
241241

242+
## File Manager support
243+
244+
References to files (as placed by Filepicker) can be in different forms - contaning file ID (e.g. `{file:123:url}`), or contaning directory ID and file name (e.g. `{filedir_2}filename.jpg`) when in [Compatibility Mode](control-panel/file-manager/file-manager.md#compatibility-mode).
245+
246+
To get both cases parsed correctly, please use `ee()->file_field->parse_string` function.
247+
248+
ee()->load->library('file_field');
249+
$data = ee()->file_field->parse_string($data);
250+
251+
If you fieldtype is using custom JavaScript for treating the files, be sure to make the code aware of [`EE.fileManagerCompatibilityMode`](development/control-panel-js/globals.md#filemanagercompatibilitymode) variable.
242252

243253
## Implementing Filepicker for Rich Text Editor
244254

0 commit comments

Comments
 (0)