aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2016-08-02 11:02:20 +0200
committerArthurHoaro <arthur@hoa.ro>2016-08-02 11:12:01 +0200
commit15170b516429341ae8e1a9ad2111be5ef90bf6aa (patch)
treea6fcbefb1c26c5e6059d0158530f8a6e4599f399 /application
parent559315ba0a89e306bc46d0a540f1536193860580 (diff)
downloadShaarli-15170b516429341ae8e1a9ad2111be5ef90bf6aa.tar.gz
Shaarli-15170b516429341ae8e1a9ad2111be5ef90bf6aa.tar.zst
Shaarli-15170b516429341ae8e1a9ad2111be5ef90bf6aa.zip
Parse plugin parameters description with the PluginManager
Plugin parameter can contain a description in their meta file under the key: parameter.<param_name>="<description>"
Diffstat (limited to 'application')
-rw-r--r--application/PluginManager.php6
-rw-r--r--application/config/ConfigPlugin.php10
2 files changed, 12 insertions, 4 deletions
diff --git a/application/PluginManager.php b/application/PluginManager.php
index dca7e63e..07bc1da9 100644
--- a/application/PluginManager.php
+++ b/application/PluginManager.php
@@ -185,7 +185,11 @@ class PluginManager
185 continue; 185 continue;
186 } 186 }
187 187
188 $metaData[$plugin]['parameters'][$param] = ''; 188 $metaData[$plugin]['parameters'][$param]['value'] = '';
189 // Optional parameter description in parameter.PARAM_NAME=
190 if (isset($metaData[$plugin]['parameter.'. $param])) {
191 $metaData[$plugin]['parameters'][$param]['desc'] = $metaData[$plugin]['parameter.'. $param];
192 }
189 } 193 }
190 } 194 }
191 195
diff --git a/application/config/ConfigPlugin.php b/application/config/ConfigPlugin.php
index 047d2b03..cb0b6fce 100644
--- a/application/config/ConfigPlugin.php
+++ b/application/config/ConfigPlugin.php
@@ -80,9 +80,13 @@ function validate_plugin_order($formData)
80} 80}
81 81
82/** 82/**
83 * Affect plugin parameters values into plugins array. 83 * Affect plugin parameters values from the ConfigManager into plugins array.
84 * 84 *
85 * @param mixed $plugins Plugins array ($plugins[<plugin_name>]['parameters']['param_name'] = <value>. 85 * @param mixed $plugins Plugins array:
86 * $plugins[<plugin_name>]['parameters'][<param_name>] = [
87 * 'value' => <value>,
88 * 'desc' => <description>
89 * ]
86 * @param mixed $conf Plugins configuration. 90 * @param mixed $conf Plugins configuration.
87 * 91 *
88 * @return mixed Updated $plugins array. 92 * @return mixed Updated $plugins array.
@@ -97,7 +101,7 @@ function load_plugin_parameter_values($plugins, $conf)
97 101
98 foreach ($plugin['parameters'] as $key => $param) { 102 foreach ($plugin['parameters'] as $key => $param) {
99 if (!empty($conf[$key])) { 103 if (!empty($conf[$key])) {
100 $out[$name]['parameters'][$key] = $conf[$key]; 104 $out[$name]['parameters'][$key]['value'] = $conf[$key];
101 } 105 }
102 } 106 }
103 } 107 }