3 * @file src/Model/Storage/IStorage.php
4 * @brief Storage backend system
7 namespace Friendica\Model\Storage;
10 * @brief Interface for storage backends
15 * @brief Get data from backend
16 * @param string $ref Data reference
19 public static function get($ref);
22 * @brief Put data in backend as $ref. If $ref is not defined a new reference is created.
23 * @param string $data Data to save
24 * @param string $ref Data referece. Optional.
25 * @return string Saved data referece
27 public static function put($data, $ref = "");
30 * @brief Remove data from backend
31 * @param string $ref Data referece
32 * @return boolean True on success
34 public static function delete($ref);
37 * @brief Get info about storage options
41 * This method return an array with informations about storage options
42 * from which the form presented to the user is build.
44 * The returned array is:
47 * 'option1name' => [ ..info.. ],
48 * 'option2name' => [ ..info.. ],
52 * An empty array can be returned if backend doesn't have any options
54 * The info array for each option MUST be as follows:
57 * 'type', // define the field used in form, and the type of data.
58 * // one of 'checkbox', 'combobox', 'custom', 'datetime',
59 * // 'input', 'intcheckbox', 'password', 'radio', 'richtext'
60 * // 'select', 'select_raw', 'textarea', 'yesno'
62 * 'label', // Translatable label of the field
63 * 'value', // Current value
64 * 'help text', // Translatable description for the field
65 * extra data // Optional. Depends on 'type':
66 * // select: array [ value => label ] of choices
67 * // intcheckbox: value of input element
68 * // select_raw: prebuild html string of < option > tags
69 * // yesno: array [ 'label no', 'label yes']
72 * See https://github.com/friendica/friendica/wiki/Quick-Template-Guide
74 public static function getOptions();
77 * @brief Validate and save options
79 * @param array $data Array [optionname => value] to be saved
81 * @return array Validation errors: [optionname => error message]
83 * Return array must be empty if no error.
85 public static function saveOptions($data);