[CONTROLLER] Add Controller base class, which handles rendering templates if requested HTML or json, accordingly

This commit is contained in:
Hugo Sales
2020-07-06 20:51:08 +00:00
committed by Hugo Sales
parent 6f9c70398b
commit 43e56c08f7
5 changed files with 95 additions and 26 deletions

View File

@@ -30,18 +30,23 @@
namespace App\Controller;
use App\Core\Controller;
use App\Core\Event;
use App\Util\Common;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class NetworkPublic extends AbstractController
class NetworkPublic extends Controller
{
public function __invoke()
public function onPost()
{
return ['_template' => 'network/public.html.twig'];
}
public function handle()
{
Event::handle('Test', ['foobar']);
Common::config('url', 'shortener');
return $this->render('network/public.html.twig', []);
return ['_template' => 'network/public.html.twig'];
}
}