From: VirtualTam Date: Sat, 13 Aug 2016 12:48:51 +0000 (+0200) Subject: Merge pull request #619 from ArthurHoaro/plugins/param-desc X-Git-Tag: v0.8.0~7 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=8758bb0ac8cb68d32122009dbcb977d2f0fad2b0;hp=-c;p=github%2Fshaarli%2FShaarli.git Merge pull request #619 from ArthurHoaro/plugins/param-desc Add a description to plugin parameters --- 8758bb0ac8cb68d32122009dbcb977d2f0fad2b0 diff --combined application/PluginManager.php index 1afc8d5c,07bc1da9..1e132a7f --- a/application/PluginManager.php +++ b/application/PluginManager.php @@@ -185,7 -185,11 +185,11 @@@ class PluginManage continue; } - $metaData[$plugin]['parameters'][$param] = ''; + $metaData[$plugin]['parameters'][$param]['value'] = ''; + // Optional parameter description in parameter.PARAM_NAME= + if (isset($metaData[$plugin]['parameter.'. $param])) { + $metaData[$plugin]['parameters'][$param]['desc'] = $metaData[$plugin]['parameter.'. $param]; + } } } @@@ -210,4 -214,4 +214,4 @@@ class PluginFileNotFoundException exten { $this->message = 'Plugin "'. $pluginName .'" files not found.'; } -} +} diff --combined tests/PluginManagerTest.php index c7511051,f4826e2e..ddf48185 --- a/tests/PluginManagerTest.php +++ b/tests/PluginManagerTest.php @@@ -79,11 -79,17 +79,17 @@@ class PluginManagerTest extends PHPUnit $this->pluginManager->load(array(self::$pluginName)); $expectedParameters = array( - 'pop' => '', - 'hip' => '', + 'pop' => array( + 'value' => '', + 'desc' => 'pop description', + ), + 'hip' => array( + 'value' => '', + 'desc' => '', + ), ); $meta = $this->pluginManager->getPluginsMeta(); $this->assertEquals('test plugin', $meta[self::$pluginName]['description']); $this->assertEquals($expectedParameters, $meta[self::$pluginName]['parameters']); } -} +}