How to add a view to admin dashboard?

Hey guys!

I’m developing a plugin, and wanted to add a page to the Admin dashboard. I’ve added the “filterAdminNavigationMain” filter and the correct label appears but the uri always gives me the 404 page error. From what I see in other plugins it should go directly to “MyPlugin/Views/Admin/(whatever url you put in the filter)”, and I have the php file there. What else do i need to do?

I’m sure this is an easy question but I really don’t understand what I’m missing, hoping someone can give me a hint.

Thank you!

Omeka is built on a Zend platform and follows the Model-View-Controller paradigm, so the view is called by a controller and you need to add at least one in a folder “controllers”, generally “IndexController.php”, where there are methods named “{my action}Action” that call the views inside the “admin/{controller name}/{my action}.php” .

Thank you Daniel! I’m new to Omeka and the MVC logic so the routing can get a bit confusing for me. It helped!

Best regards

I bring up this question again as I am having the same problem. Particularly, I’m not sure how to set the parameters for a new entry in the filter admin_navigation_main. Except “label” that is self-explanatory, when looking, for example, at the SimplePage plugin there are also “uri”, “resource” and “privilege”, how to set those?
Following Daniel instruction I have create an “IndexController.php” file under “controllers” with a “testAction” calling the views under “admin/index/test.php” but I get the following exception:

Zend_Acl_Exception: Resource ‘MyPlugin_Index’ not found in /var/www/omeka-dev/application/libraries/Zend/View/Helper/Navigation/HelperAbstract.php on line 635

What I am doing wrong?

Thanks in advance!
Best

Edit: I managed to get rid of the exception by adding the hook define_acl and adding the Zend_Acl_Resource “MyPlugin_Index” (the same name I set in the “resource” field in the admin_navigation_main filter). Now I don’t get an exception but still I get a 404 error…

For Omeka S, the view should have the extension .phtml, not .php. But your question seems related to Omeka Classic, where .php is used.

Thanks for the answer. I am indeed working on Omeka Classic (2.6.1 version). Any idea what the problem could be?

Edit: Ah, I just noticed I posted in the wrong Forum (Omeka S)! Sorry about that, I found this question by using the search functionality and did not noticed it was in the Omeka S forum. I will open a new question in the Omeka Classic forum. Thanks!