[TWIG][EndShowStyles] Route as an event argument
This commit is contained in:
parent
6412b632ab
commit
3cb6563c40
@ -31,7 +31,7 @@ class Left extends Component
|
|||||||
*
|
*
|
||||||
* @return bool hook value; true means continue processing, false means stop.
|
* @return bool hook value; true means continue processing, false means stop.
|
||||||
*/
|
*/
|
||||||
public function onEndShowStyles(array &$styles): bool
|
public function onEndShowStyles(array &$styles, string $route): bool
|
||||||
{
|
{
|
||||||
$styles[] = 'components/Left/assets/css/view.css';
|
$styles[] = 'components/Left/assets/css/view.css';
|
||||||
return Event::next;
|
return Event::next;
|
||||||
|
@ -31,7 +31,7 @@ class Right extends Component
|
|||||||
*
|
*
|
||||||
* @return bool hook value; true means continue processing, false means stop.
|
* @return bool hook value; true means continue processing, false means stop.
|
||||||
*/
|
*/
|
||||||
public function onEndShowStyles(array &$styles): bool
|
public function onEndShowStyles(array &$styles, string $route): bool
|
||||||
{
|
{
|
||||||
$styles[] = 'components/Right/assets/css/view.css';
|
$styles[] = 'components/Right/assets/css/view.css';
|
||||||
return Event::next;
|
return Event::next;
|
||||||
|
@ -76,7 +76,7 @@ class Search extends Component
|
|||||||
*
|
*
|
||||||
* @return bool hook value; true means continue processing, false means stop.
|
* @return bool hook value; true means continue processing, false means stop.
|
||||||
*/
|
*/
|
||||||
public function onEndShowStyles(array &$styles): bool
|
public function onEndShowStyles(array &$styles, string $route): bool
|
||||||
{
|
{
|
||||||
$styles[] = 'components/Search/assets/css/view.css';
|
$styles[] = 'components/Search/assets/css/view.css';
|
||||||
return Event::next;
|
return Event::next;
|
||||||
|
@ -31,7 +31,7 @@ class AttachmentShowRelated extends Plugin
|
|||||||
{
|
{
|
||||||
public function onAppendRightPanelBlock($vars, &$res): bool
|
public function onAppendRightPanelBlock($vars, &$res): bool
|
||||||
{
|
{
|
||||||
if ($vars['path'] == 'attachment_show') {
|
if ($vars['path'] === 'attachment_show') {
|
||||||
$related_notes = DB::dql('select n from attachment_to_note an ' .
|
$related_notes = DB::dql('select n from attachment_to_note an ' .
|
||||||
'join note n with n.id = an.note_id ' .
|
'join note n with n.id = an.note_id ' .
|
||||||
'where an.attachment_id = :attachment_id', ['attachment_id' => $vars['vars']['attachment_id']]);
|
'where an.attachment_id = :attachment_id', ['attachment_id' => $vars['vars']['attachment_id']]);
|
||||||
@ -43,4 +43,19 @@ class AttachmentShowRelated extends Plugin
|
|||||||
}
|
}
|
||||||
return Event::next;
|
return Event::next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output our dedicated stylesheet
|
||||||
|
*
|
||||||
|
* @param array $styles stylesheets path
|
||||||
|
*
|
||||||
|
* @return bool hook value; true means continue processing, false means stop.
|
||||||
|
*/
|
||||||
|
public function onEndShowStyles(array &$styles, string $path): bool
|
||||||
|
{
|
||||||
|
if ($path === 'attachment_show') {
|
||||||
|
$styles[] = '/assets/default_theme/css/pages/feeds.css';
|
||||||
|
}
|
||||||
|
return Event::next;
|
||||||
|
}
|
||||||
}
|
}
|
@ -82,10 +82,10 @@ class Runtime implements RuntimeExtensionInterface, EventSubscriberInterface
|
|||||||
* @return array|mixed
|
* @return array|mixed
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
public function getShowStylesheets()
|
public function getShowStylesheets($route)
|
||||||
{
|
{
|
||||||
$styles = [];
|
$styles = [];
|
||||||
Event::handle('EndShowStyles', [&$styles]);
|
Event::handle('EndShowStyles', [&$styles, $route]);
|
||||||
return $styles;
|
return $styles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<link rel="preload" href="{{ asset('assets/default_theme/css/base.css') }}" as="style" type="text/css">
|
<link rel="preload" href="{{ asset('assets/default_theme/css/base.css') }}" as="style" type="text/css">
|
||||||
<link rel="stylesheet" href="{{ asset('assets/default_theme/css/base.css') }}">
|
<link rel="stylesheet" href="{{ asset('assets/default_theme/css/base.css') }}">
|
||||||
|
|
||||||
{% for stylesheet in show_stylesheets() %}
|
{% for stylesheet in show_stylesheets(app.request.get('_route')) %}
|
||||||
<link rel='stylesheet' type='text/css' href="{{ asset(stylesheet) }}">
|
<link rel='stylesheet' type='text/css' href="{{ asset(stylesheet) }}">
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user