* Interface IDatasource * * @since 3.1.0 */
| 15 | * @since 3.1.0 |
| 16 | */ |
| 17 | interface IDatasource |
| 18 | { |
| 19 | |
| 20 | /** |
| 21 | * @return string Display Name of the data source |
| 22 | * @since 3.1.0 |
| 23 | */ |
| 24 | public function getName(): string; |
| 25 | |
| 26 | /** |
| 27 | * @return int 2 digit unique data source id |
| 28 | * @since 3.1.0 |
| 29 | */ |
| 30 | public function getId(): int; |
| 31 | |
| 32 | /** |
| 33 | * available options of the data source |
| 34 | * |
| 35 | * return needs to be an array and can consist of many fields. |
| 36 | * every field needs to provide the following format |
| 37 | * id *mandatory* = name of the option for the readData |
| 38 | * name *mandatory* = displayed name of the input field in the UI |
| 39 | * type *optional* = 'valueList' for a dropdown with allowed values separated by "/" in the placeholder. |
| 40 | * 'tf' is a legacy alias for 'valueList'. |
| 41 | * 'filePicker' will launch the file picker |
| 42 | * 'columnPicker' will launch the file picker |
| 43 | * 'number' for a number-only input field |
| 44 | * 'section' will create a click-able section header and hide all options afterwards per default |
| 45 | * 'longtext' will create a text area input |
| 46 | * placeholder *mandatory* = help text for the input field in the UI |
| 47 | * allowTextVariables *optional* = adds a separate editor for text variables without triggering the input's primary action |
| 48 | * for type=valueList: |
| 49 | * e.g. "true/false" |
| 50 | * if value/text pairs are required for the dropdown/option, the values need to be separated with "-" in addition. |
| 51 | * e.g. "eq-equal/gt-greater" |
| 52 | * Numeric lists split at slashes before the next labelled numeric value (e.g. "12" or "12:3"). |
| 53 | * to avoid translation of the technical strings, separate them |
| 54 | * 'true-' - $this->l10n->t('Yes').'/false-'.$this->l10n->t('No') |
| 55 | * |
| 56 | * example: |
| 57 | * {['id' => 'datatype', 'name' => 'Type of Data', 'type' => 'valueList', 'placeholder' => 'adaptation/absolute']} |
| 58 | * |
| 59 | * @return array |
| 60 | * @since 3.1.0 |
| 61 | */ |
| 62 | public function getTemplate(): array; |
| 63 | |
| 64 | /** |
| 65 | * Read the Data |
| 66 | * |
| 67 | * return needs to be an array |
| 68 | * [ |
| 69 | * 'header' => $header, //array('column header 1', 'column header 2','column header 3') |
| 70 | * 'dimensions' => array_slice($header, 0, count($header) - 1), |
| 71 | * 'data' => $data, |
| 72 | * 'error' => 0, // INT 0 = no error |
| 73 | * 'cache' => [ // optional datasource controlled cache metadata |
| 74 | * 'cacheable' => true, |
nothing calls this directly
no outgoing calls
no test coverage detected