[PLUGIN] Update example plugin

This commit is contained in:
Hugo Sales 2020-08-03 20:53:40 +00:00 committed by Hugo Sales
parent ea7d43172a
commit 995b4cfb9b
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
2 changed files with 17 additions and 7 deletions

View File

@ -1,14 +1,15 @@
<?php
namespace App\Controller;
namespace Plugin\Test\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use App\Core\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class TestController extends AbstractController
class TestController extends Controller
{
public function __invoke()
public function __invoke(Request $request)
{
return new Response('<div style="background: #333; text-color: #999"> Test controller </div>');
return new Response('<html style="background: #333; color: #ccc"> Test controller </div>');
}
}

View File

@ -2,10 +2,19 @@
namespace Plugin\Test;
class Test
use App\Core\Module;
use App\Core\Router\RouteLoader;
use Plugin\Test\Controller\TestController;
class Test extends Module
{
public function onTest(string $foo)
{
dump('Event handled: ' . $foo);
var_dump('Event handled: ' . $foo);
}
public function onAddRoute(RouteLoader $r)
{
$r->connect('test_foo', '/foo', TestController::class);
}
}