[Cover] Added TWIG vars for profile plugins

This commit is contained in:
Daniel 2020-11-25 22:10:56 +00:00 committed by Hugo Sales
parent 1cfe64cc25
commit cf8b3b7b73
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
6 changed files with 14 additions and 5 deletions

View File

@ -67,7 +67,7 @@ class Cover
// Can only get new id after inserting
DB::flush();
$cover = CoverEntity::create(['gsactor_id' => $actor_id, 'file_id' => $file->getId()]);
var_dump($cover);
//var_dump($cover);
DB::persist($cover);
DB::flush();
// Only delete files if the commit went through
@ -76,6 +76,6 @@ class Cover
}
}
return ['_template' => 'Cover/cover.html.twig', 'form' => $form->createView()];
return ['_template' => 'cover/cover.html.twig', 'form' => $form->createView()];
}
}

View File

@ -23,6 +23,7 @@ namespace Plugin\Cover;
use App\Core\Event;
use App\Core\Module;
use App\Core\Router\RouteLoader;
use App\Util\Common;
class Cover extends Module
{
@ -57,6 +58,10 @@ class Cover extends Module
$vars['profile_tabs'] = [['title' => 'Cover',
'href' => 'settings_cover',
]];
if (Common::user() != null) {
$vars['profile_temp'][] = ['name' => 'cover', 'vars' => ['href' => 'test']];
}
return Event::next;
}

View File

@ -1,3 +0,0 @@
<div class="Cover">
</div>

View File

@ -0,0 +1,4 @@
<div class="Cover">
<h1> {{ vars.href }}</h1>
</div>

View File

@ -17,6 +17,9 @@
<div class='navbar'>
<div class="left-nav">
<div class='profile'>
{% for temp in profile_temp %}
{% include '/'~ temp.name ~ '/view.html.twig' with {'vars': temp.vars} only %}
{% endfor %}
<a href="{{ path('settings_avatar') }}">
<img src='{{ user_avatar }}' alt="Your avatar." class="icon icon-avatar">
</a>