mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-29 10:08:47 +08:00
Improved Plugin Property handling
This commit is contained in:
parent
cc6a4c4de9
commit
364947d1f9
2 changed files with 14 additions and 36 deletions
|
@ -13,11 +13,12 @@ class Plugin extends \RainLoop\Config\AbstractConfig
|
|||
{
|
||||
if (\count($aMap)) {
|
||||
$aResultMap = array();
|
||||
foreach ($aMap as /* @var $oProperty \RainLoop\Plugins\Property */ $oProperty) {
|
||||
if ($oProperty) {
|
||||
$mValue = $oProperty->DefaultValue();
|
||||
$sValue = \is_array($mValue) && isset($mValue[0]) ? $mValue[0] : $mValue;
|
||||
$aResultMap[$oProperty->Name()] = array($sValue, '');
|
||||
foreach ($aMap as $oProperty) {
|
||||
if ($oProperty instanceof \RainLoop\Plugins\Property) {
|
||||
$aResultMap[$oProperty->Name()] = array(
|
||||
$oProperty->DefaultValue(),
|
||||
''
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +29,7 @@ class Plugin extends \RainLoop\Config\AbstractConfig
|
|||
}
|
||||
}
|
||||
|
||||
// parent::__construct('plugin-'.$sPluginName.'.ini', '; SnappyMail plugin ('.$sPluginName.')');
|
||||
parent::__construct('plugin-'.$sPluginName.'.json');
|
||||
}
|
||||
|
||||
|
|
|
@ -4,55 +4,31 @@ namespace RainLoop\Plugins;
|
|||
|
||||
class Property implements \JsonSerializable
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $sName;
|
||||
private string $sName;
|
||||
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
private $mValue;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $sLabel;
|
||||
private string $sLabel = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $sDesc;
|
||||
private string $sDesc = '';
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $iType;
|
||||
private int $iType = \RainLoop\Enumerations\PluginPropertyType::STRING;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $bAllowedInJs;
|
||||
private bool $bAllowedInJs = false;
|
||||
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
private $mDefaultValue;
|
||||
private $mDefaultValue = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $sPlaceholder;
|
||||
private string $sPlaceholder = '';
|
||||
|
||||
function __construct(string $sName)
|
||||
{
|
||||
$this->sName = $sName;
|
||||
$this->iType = \RainLoop\Enumerations\PluginPropertyType::STRING;
|
||||
$this->mDefaultValue = '';
|
||||
$this->sLabel = '';
|
||||
$this->sDesc = '';
|
||||
$this->bAllowedInJs = false;
|
||||
$this->sPlaceholder = '';
|
||||
}
|
||||
|
||||
public static function NewInstance(string $sName) : self
|
||||
|
|
Loading…
Reference in a new issue