diff options
author | 2023-03-06 20:01:51 +0100 | |
---|---|---|
committer | 2023-03-06 20:01:51 +0100 | |
commit | f0e5ef0fc58f3796bb4c03caa2c5e7ca78de119e (patch) | |
tree | 3fc1c388de7bebf2a0b729237864465f3dbdd915 /docs/06_Helper_functions/index.md | |
parent | b40714079ff106700fb27e6a8fd12d77fb3d0e76 (diff) | |
download | rss-bridge-f0e5ef0fc58f3796bb4c03caa2c5e7ca78de119e.tar.gz rss-bridge-f0e5ef0fc58f3796bb4c03caa2c5e7ca78de119e.tar.zst rss-bridge-f0e5ef0fc58f3796bb4c03caa2c5e7ca78de119e.zip |
[Various] getKey replacements and docu (#3283)
* [Various] getKey replacements and docu
* more bridges and fix to the abstract
* linting
* revert bandcampdaily. doing more than i thought
Diffstat (limited to 'docs/06_Helper_functions/index.md')
-rw-r--r-- | docs/06_Helper_functions/index.md | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/docs/06_Helper_functions/index.md b/docs/06_Helper_functions/index.md index 33f9eb37..a2568848 100644 --- a/docs/06_Helper_functions/index.md +++ b/docs/06_Helper_functions/index.md @@ -7,6 +7,35 @@ $this->getInput('your input name here'); `getInput` will either return the value for your parameter or `null` if the parameter is unknown or not specified. +# getKey +The `getKey` function is used to receive the key name to a selected list value given the name of the list, specified in `const PARAMETERS` +Is able to work with multidimensional list arrays. + +```PHP +// Given a multidimensional array like this +const PARAMETERS = [[ + 'country' => [ + 'name' => 'Country', + 'type' => 'list', + 'values' => [ + 'North America' => [ + 'Mexico' => 'mx', + 'United States' => 'us' + ], + 'South America' => [ + 'Uruguay' => 'uy', + 'Venezuela' => 've' + ], + ] + ] +]], +// Provide the list name to the function +$this->getKey('country'); +// if the selected value was "ve", this function will return "Venezuela" +``` + +`getKey` will either return the key name for your parameter or `null` if the parameter is unknown or not specified. + # getContents The `getContents` function uses [cURL](https://secure.php.net/manual/en/book.curl.php) to acquire data from the specified URI while respecting the various settings defined at a global level by RSS-Bridge (i.e., proxy host, user agent, etc.). This function accepts a few parameters: |