X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=doc%2FAddonStorageBackend.md;h=950a2ad88d9dd6ab26a8f961106c635f61bc41ef;hb=adfb94d370b29e97b0f81de95d9a041d7d4b7f79;hp=d6ad9d37dbde3f56e1267ba2ad3231f606321211;hpb=ce31ccaade3874233950e283b580007ea314f3aa;p=friendica.git diff --git a/doc/AddonStorageBackend.md b/doc/AddonStorageBackend.md index d6ad9d37db..950a2ad88d 100644 --- a/doc/AddonStorageBackend.md +++ b/doc/AddonStorageBackend.md @@ -14,23 +14,27 @@ The class must implement `Friendica\Model\Storage\IStorage` interface. All metho namespace Friendica\Model\Storage; - interface IStorage - { - public static function get($ref); - public static function put($data, $ref = ""); - public static function delete($ref); - public static function getOptions(); - public static function saveOptions($data); - } +```php +interface IStorage +{ + public function get(string $reference); + public function put(string $data, string $reference = ''); + public function delete(string $reference); + public function getOptions(); + public function saveOptions(array $data); + public function __toString(); + public static function getName(); +} +``` -- `get($ref)` returns data pointed by `$ref` -- `put($data, $ref)` saves data in `$data` to position `$ref`, or a new position if `$ref` is empty. -- `delete($ref)` delete data pointed by `$ref` +- `get(string $reference)` returns data pointed by `$reference` +- `put(string $data, string $reference)` saves data in `$data` to position `$reference`, or a new position if `$reference` is empty. +- `delete(string $reference)` delete data pointed by `$reference` Each storage backend can have options the admin can set in admin page. - `getOptions()` returns an array with details about each option to build the interface. -- `saveOptions($data)` get `$data` from admin page, validate it and save it. +- `saveOptions(array $data)` get `$data` from admin page, validate it and save it. The array returned by `getOptions()` is defined as: @@ -48,7 +52,7 @@ The info array for each option is defined as: 'type', define the field used in form, and the type of data. -one of 'checkbox', 'combobox', 'custom', 'datetime', 'input', 'intcheckbox', 'password', 'radio', 'richtext', 'select', 'select_raw', 'textarea', 'yesno' +one of 'checkbox', 'combobox', 'custom', 'datetime', 'input', 'intcheckbox', 'password', 'radio', 'richtext', 'select', 'select_raw', 'textarea' 'label', @@ -69,7 +73,6 @@ Optional. Depends on which 'type' this option is: - 'select': array `[ value => label ]` of choices - 'intcheckbox': value of input element - 'select_raw': prebuild html string of `