Jump to content
Sign in to follow this  
Chris van der Westhuizen

adding pages to plugin with own module, view and controller and actions

Recommended Posts

Hi all.  I am trying to add a page to the Feed reader plugin I called Mapping.  The functionality of the current feed reader plugin default page and add url sub page is what I am trying to use with a custom table for mapping purposes with another application.  I cannot seem to get the basics working. And that is to have a mappings controller, module and view, and language file, with a button on the main form next to the + icon for adding a new feed. I did work through the documentation but for a .net developer I am a little dumbstruck with the PHP.  I do believe I have the potential to manage once I can get the above mentioned to work.  I am a person whom is eager to help.  Currently I am in need of help. 🙂

What I did so far:

I use the debugger plugin for debugging.

plugins/feed_reader/controllers/admin_manage_plugin.php I copied to admin_manage_plugin_mappings.php and change all naming to the appropriate mappings naming. e.g. the word feed to mapping etc.

plugins/feed_reader/language/en_us/feed_reader_feeds.php I copied to feed_reader_mappings.php and change all the naming to the appropriate mappings naming.
plugins/feed_reader/language/en_us/feed_reader_manage_plugin.php I copied to feed_reader_manage_plugin_mappings.php and change all the naming to the appropriate mappings naming

plugins/feed_reader/models/feed_reader_feeds.php I copied to feed_reader_mappings.php and change all teh naming to appropriate mappings naming.

plugins/feed_reader/views/default/admin_manage_plugin.pdt to admin_manage_plugin_mappings.pdt and change the naming inside accordingly.
plugins/feed_reader/views/default/admin_manage_plugin_add.pdt to admin_manage_plugin_mappings_add.pdt and change the naming inside accordingly

e.g. in the admin_manage_plugin_mappings.php file the "class AdminManagePlugin extends AppController" becomes "class AdminManagePluginMappings extends AppController" and "FeedReaderFeeds" becomes "FeedReaderMappings" etc.

I am trying to manually change the url to maybe show something by changing in the browser the "http://localhost/blesta/index.php/admin/settings/company/plugins/manage/10/" to "http://localhost/blesta/index.php/admin/settings/company/plugins/manage/10/mappings/" or "http://localhost/blesta/index.php/admin/settings/company/plugins/manage/10/mappings/?action=add" and some other combinations. Maybe I don't understand how it work 🙂

I will change the the queries and so on, but will do so once I manage to at lease see the Mappings button and the content of the new mappings view.

I unfortunately cannot find an appropriate example through all the other plugin sources.

I am wondering what I am missing? accept for my brain at this stage hahahahahaha.

Kind Regards
Chris

 

Share this post


Link to post
Share on other sites

The AdminManagePlugin controller is a special controller (see docs for reference) that loads the plugin management controller from /admin/settings/company/plugins/manage/PLUGIN_ID/ in Blesta. If you want your mapping to be managed similarly, you should create methods in AdminManagePlugin to do so, and use GET arguments to request your specific AdminManagePlugin method (e.g. "AdminManagePlugin::refresh" is called when visiting admin/settings/company/plugins/manage/PLUGIN_ID/?action=refresh).

If you want to manage your plugin elsewhere, such as from its own page, you can certainly do so however you'd like, as the plugin's controllers can be requested directly at their own URI, e.g. /admin/plugin/feed_reader/my_controller/my_method/

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×