remove unnecessary hook
This commit is contained in:
parent
2fb67537df
commit
f22867c7cf
|
|
@ -53,9 +53,6 @@ class Hook
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add routes. A router instance will be passed to the given callback.
|
||||
*/
|
||||
public static function addRoute(Closure $callback): void
|
||||
{
|
||||
Event::listen(Events\ConfigureRoutes::class, function ($event) use ($callback) {
|
||||
|
|
@ -63,28 +60,6 @@ class Hook
|
|||
});
|
||||
}
|
||||
|
||||
public static function registerPluginTransScripts(string $name, $pages = ['*']): void
|
||||
{
|
||||
Event::listen(Events\RenderingFooter::class, function ($event) use ($name, $pages) {
|
||||
foreach ($pages as $pattern) {
|
||||
if (!request()->is($pattern)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// We will determine current locale in the event callback,
|
||||
// otherwise the locale is not properly detected.
|
||||
$basepath = config('plugins.url') ?: url('plugins').'/'.$name.'/';
|
||||
$relative = 'lang/'.config('app.locale').'/locale.js';
|
||||
|
||||
$event->addContent(
|
||||
'<script src="'.$basepath.$relative.'"></script>'
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static function addStyleFileToPage($urls, $pages = ['*']): void
|
||||
{
|
||||
Event::listen(Events\RenderingHeader::class, function ($event) use ($urls, $pages) {
|
||||
|
|
|
|||
|
|
@ -44,13 +44,6 @@ class HookTest extends TestCase
|
|||
$this->get('/test-hook')->assertSuccessful();
|
||||
}
|
||||
|
||||
public function testRegisterPluginTransScripts()
|
||||
{
|
||||
Hook::registerPluginTransScripts('fake-plugin-with-i18n', ['/']);
|
||||
$this->get('/')->assertSee('fake-plugin-with-i18n/lang/en/locale.js');
|
||||
$this->get('/skinlib')->assertDontSee('fake-plugin-with-i18n/lang/en/locale.js');
|
||||
}
|
||||
|
||||
public function testAddStyleFileToPage()
|
||||
{
|
||||
Hook::addStyleFileToPage('/style/all');
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user