[SETTINGS][PLUGIN][CONTROLLER] Populate profile tabs event added. Settings base template populated with such event for plugins and components.

Signed-off-by: Eliseu Amaro <mail@eliseuama.ro>
This commit is contained in:
2021-07-29 20:20:32 +01:00
committed by Hugo Sales
parent 6dd0292397
commit c8a8e94d48
11 changed files with 91 additions and 77 deletions

View File

@@ -25,6 +25,8 @@ use App\Core\Event;
use App\Core\Modules\Plugin;
use App\Core\Router\RouteLoader;
use App\Util\Common;
use Plugin\Cover\Controller as C;
use Symfony\Component\HttpFoundation\Request;
/**
* Cover plugin main class
@@ -52,6 +54,17 @@ class Cover extends Plugin
return Event::next;
}
public function onPopulateProfileSettingsTabs(Request $request, &$tabs)
{
$tabs[] = [
'title' => 'Cover',
'desc' => 'Change your cover.',
'controller' => C\Cover::coverSettings($request),
];
return Event::next;
}
/**
* Populate twig vars
*
@@ -61,18 +74,14 @@ class Cover extends Plugin
*/
public function onStartTwigPopulateVars(array &$vars): bool
{
$vars['profile_tabs'][] = ['title' => 'Cover',
'route' => 'settings_profile_cover',
];
if (Common::user() != null) {
/*if (Common::user() != null) {
$cover = DB::find('cover', ['gsactor_id' => Common::user()->getId()]);
if ($cover != null) {
$vars['profile_extras'][] = ['name' => 'cover', 'vars' => ['img' => '/cover']];
} else {
$vars['profile_extras'][] = ['name' => 'cover', 'vars' => []];
}
}
}*/
return Event::next;
}