/
interface.importablefield.php
61 lines (55 loc) · 1.75 KB
/
interface.importablefield.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* @package interface
*/
/**
* The `ImportableField` interface defines the functions required to implement
* the field import API.
*
* @since Symphony 2.3.1
* @link https://github.com/symphonycms/symphony-2/issues/1394
*/
interface ImportableField {
/**
* Prepare a string for a field, oriented towards the human readable.
*
* @since Symphony 2.3.2
* @var integer
*/
const STRING_VALUE = 1100;
/**
* Select raw values from a field, usually as an associative array
* that `processRawFieldData` would generate.
*
* @since Symphony 2.3.2
* @var integer
*/
const ARRAY_VALUE = 1101;
/**
* Return a list of supported import modes for use with `prepareImportValue`.
*
* @return array
*/
public function getImportModes();
/**
* Give the field some data and ask it to return a value.
*
* @since Symphony 2.3.2 the method signature changed to add `$mode`
* as the second parameter. The default signature restores functionality
* present prior to Symphony 2.3.1
*
* @param mixed $data
* The data to sanitise/prepare so that it can be added to Symphony.
* @param integer $mode
* The `$mode` dictates how this function should return it's value. Prior
* to Symphony 2.3.1, the pseudo implementation of this function returned
* strings, whereas in Symphony 2.3.1 the function returned arrays. `$mode`
* toggles between these two return types (for now)
* @param integer $entry_id
* If there is an existing entry that this value is being imported into,
* the `$entry_id` can allow the field to do additional processing/checking
* @return array|string
* Dependent on the `$mode`
*/
public function prepareImportValue($data, $mode, $entry_id = null);
}