forked from GNUsocial/gnu-social
[PLUGIN] Update example plugin
This commit is contained in:
parent
ea7d43172a
commit
995b4cfb9b
@ -1,14 +1,15 @@
|
|||||||
<?php
|
<?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;
|
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>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,19 @@
|
|||||||
|
|
||||||
namespace Plugin\Test;
|
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)
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user