mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-30 10:37:54 +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)) {
|
if (\count($aMap)) {
|
||||||
$aResultMap = array();
|
$aResultMap = array();
|
||||||
foreach ($aMap as /* @var $oProperty \RainLoop\Plugins\Property */ $oProperty) {
|
foreach ($aMap as $oProperty) {
|
||||||
if ($oProperty) {
|
if ($oProperty instanceof \RainLoop\Plugins\Property) {
|
||||||
$mValue = $oProperty->DefaultValue();
|
$aResultMap[$oProperty->Name()] = array(
|
||||||
$sValue = \is_array($mValue) && isset($mValue[0]) ? $mValue[0] : $mValue;
|
$oProperty->DefaultValue(),
|
||||||
$aResultMap[$oProperty->Name()] = array($sValue, '');
|
''
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +29,7 @@ class Plugin extends \RainLoop\Config\AbstractConfig
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// parent::__construct('plugin-'.$sPluginName.'.ini', '; SnappyMail plugin ('.$sPluginName.')');
|
||||||
parent::__construct('plugin-'.$sPluginName.'.json');
|
parent::__construct('plugin-'.$sPluginName.'.json');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,55 +4,31 @@ namespace RainLoop\Plugins;
|
||||||
|
|
||||||
class Property implements \JsonSerializable
|
class Property implements \JsonSerializable
|
||||||
{
|
{
|
||||||
/**
|
private string $sName;
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $sName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var mixed
|
* @var mixed
|
||||||
*/
|
*/
|
||||||
private $mValue;
|
private $mValue;
|
||||||
|
|
||||||
/**
|
private string $sLabel = '';
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $sLabel;
|
|
||||||
|
|
||||||
/**
|
private string $sDesc = '';
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $sDesc;
|
|
||||||
|
|
||||||
/**
|
private int $iType = \RainLoop\Enumerations\PluginPropertyType::STRING;
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
private $iType;
|
|
||||||
|
|
||||||
/**
|
private bool $bAllowedInJs = false;
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
private $bAllowedInJs;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var mixed
|
* @var mixed
|
||||||
*/
|
*/
|
||||||
private $mDefaultValue;
|
private $mDefaultValue = '';
|
||||||
|
|
||||||
/**
|
private string $sPlaceholder = '';
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $sPlaceholder;
|
|
||||||
|
|
||||||
function __construct(string $sName)
|
function __construct(string $sName)
|
||||||
{
|
{
|
||||||
$this->sName = $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
|
public static function NewInstance(string $sName) : self
|
||||||
|
|
Loading…
Reference in a new issue