Skip to content

Commit de3d3b3

Browse files
authored
Merge pull request #568 from ExpressionEngine/bug/7.x/fieldtypes-filemanager-integration
dev docs on using filemanager with fieldtypes
2 parents c3fd92d + 1167ab2 commit de3d3b3

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+
When a file is referenced inside content, it can be in two different forms depending on if the file manager is running in compatibility mode or not. An example of this is when a file is chosen inside an RTE field via the filepicker. If the file manager is not running in [compatibility mode](control-panel/file-manager/file-manager.md#compatibility-mode), the file references in content will contain a file ID (e.g. `{file:123:url}` where 123 is the file ID). The file can also be referenced in content with a directory ID and file name (e.g. `{filedir_2}filename.jpg`) when in compatibility mode.
245+
246+
To parse both cases correctly, please use the `ee()->file_field->parse_string()` function.
247+
248+
ee()->load->library('file_field');
249+
$data = ee()->file_field->parse_string($data);
250+
251+
If the fieldtype is using custom JavaScript for manipulating the files, be sure to make the code aware of the [`EE.fileManagerCompatibilityMode`](development/control-panel-js/globals.md#filemanagercompatibilitymode) variable.
242252

243253
## Implementing Filepicker for Rich Text Editor
244254

0 commit comments

Comments
 (0)