Skip to content

Where is being "route" created? #4

@ttodua

Description

@ttodua

I've followed the example provided in plugin to add /my_custom_page route. For example, we want to add a menu page or whatever page, under Azuracast (to be accessible by admin, at https://example.com/station/1/my_custom_page and https://example.com/admin/my_custom_page

However, after restarting container azuracast_web , when i visit mysite.com/my_custom_page, I get:

404 Not Found
The requested resource could not be found. Please verify the URI and try again.
Go Back

here the code in example-plugin:


$dispatcher->addListener(Event\BuildView::class, function(Event\BuildView $event) {
	$event->getView()->addFolder('my_custom_page', __DIR__.'/templates');
});

 
$dispatcher->addListener(Event\BuildRoutes::class, function(Event\BuildRoutes $event) {
	$app = $event->getApp();

	$app->get('/my_custom_page', \Plugin\ExamplePlugin\Controller\HelloWorld::class)->setName('example-plugin:sample:index')
	  ->add(\App\Middleware\EnableView::class);
	  
});

$dispatcher->addListener(App\Event\BuildAdminMenu::class, function (App\Event\BuildAdminMenu $e) {
	$router = $e->getRouter();
	$e->merge([
		'myCustomParentMenu' => [
			'label' => __('My example Menu'),
			'icon' => 'router',
			'items' => [
				'settings2' => [
					'label' => __('My example Menu Label'),
					'url' => $router->named('example-plugin:sample:index'),
					'permission' => Acl::GLOBAL_SETTINGS,
				]
			],
		]
	]);	

});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions