mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 07:35:55 +08:00
Move TestSuggestions to Example plugin
This commit is contained in:
parent
0672a73c0b
commit
02e3ce779c
14
plugins/example/ContactSuggestions.php
Normal file
14
plugins/example/ContactSuggestions.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Plugins\Example;
|
||||
|
||||
class ContactSuggestions implements \RainLoop\Providers\Suggestions\ISuggestions
|
||||
{
|
||||
public function Process(\RainLoop\Model\Account $oAccount, string $sQuery, int $iLimit = 20) : array
|
||||
{
|
||||
return array(
|
||||
array($oAccount->Email(), ''),
|
||||
array('email@domain.com', 'name')
|
||||
);
|
||||
}
|
||||
}
|
|
@ -13,9 +13,10 @@ class ExamplePlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
LICENSE = 'MIT',
|
||||
DESCRIPTION = '';
|
||||
|
||||
/*
|
||||
public function Init() : void
|
||||
{
|
||||
$this->addHook('main.fabrica', 'MainFabrica');
|
||||
/*
|
||||
$this->addCss(string $sFile, bool $bAdminScope = false);
|
||||
$this->addJs(string $sFile, bool $bAdminScope = false);
|
||||
$this->addHook(string $sHookName, string $sFunctionName);
|
||||
|
@ -29,8 +30,36 @@ class ExamplePlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
|
||||
$this->addTemplate(string $sFile, bool $bAdminScope = false);
|
||||
$this->addTemplateHook(string $sName, string $sPlace, string $sLocalTemplateName, bool $bPrepend = false);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $mResult
|
||||
*/
|
||||
public function MainFabrica(string $sName, &$mResult)
|
||||
{
|
||||
switch ($sName) {
|
||||
case 'files':
|
||||
case 'storage':
|
||||
case 'storage-local':
|
||||
case 'settings':
|
||||
case 'settings-local':
|
||||
case 'login':
|
||||
case 'domain':
|
||||
case 'filters':
|
||||
case 'address-book':
|
||||
case 'identities':
|
||||
break;
|
||||
|
||||
case 'suggestions':
|
||||
if (!\is_array($mResult)) {
|
||||
$mResult = array();
|
||||
}
|
||||
require_once __DIR__ . '/ContactsSuggestions.php';
|
||||
$mResult[] = new \Plugins\Example\ContactSuggestions();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public function Config() : \RainLoop\Config\Plugin
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace RainLoop\Providers\Suggestions;
|
||||
|
||||
use RainLoop\Model\Account;
|
||||
|
||||
class TestSuggestions implements ISuggestions
|
||||
{
|
||||
public function Process(Account $oAccount, string $sQuery, int $iLimit = 20) : array
|
||||
{
|
||||
return array(
|
||||
array($oAccount->Email(), ''),
|
||||
array('email@domain.com', 'name')
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue