Move TestSuggestions to Example plugin

This commit is contained in:
the-djmaze 2022-05-13 20:25:52 +02:00
parent 0672a73c0b
commit 02e3ce779c
3 changed files with 45 additions and 18 deletions

View 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')
);
}
}

View file

@ -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

View file

@ -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')
);
}
}