mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Move TestSuggestions to Example plugin
This commit is contained in:
parent
0672a73c0b
commit
02e3ce779c
3 changed files with 45 additions and 18 deletions
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',
|
LICENSE = 'MIT',
|
||||||
DESCRIPTION = '';
|
DESCRIPTION = '';
|
||||||
|
|
||||||
/*
|
|
||||||
public function Init() : void
|
public function Init() : void
|
||||||
{
|
{
|
||||||
|
$this->addHook('main.fabrica', 'MainFabrica');
|
||||||
|
/*
|
||||||
$this->addCss(string $sFile, bool $bAdminScope = false);
|
$this->addCss(string $sFile, bool $bAdminScope = false);
|
||||||
$this->addJs(string $sFile, bool $bAdminScope = false);
|
$this->addJs(string $sFile, bool $bAdminScope = false);
|
||||||
$this->addHook(string $sHookName, string $sFunctionName);
|
$this->addHook(string $sHookName, string $sFunctionName);
|
||||||
|
|
@ -29,8 +30,36 @@ class ExamplePlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
|
|
||||||
$this->addTemplate(string $sFile, bool $bAdminScope = false);
|
$this->addTemplate(string $sFile, bool $bAdminScope = false);
|
||||||
$this->addTemplateHook(string $sName, string $sPlace, string $sLocalTemplateName, bool $bPrepend = 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
|
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…
Add table
Add a link
Reference in a new issue