First of all we need to create a folder inside modules folder, basically we will see it in C:\wamp\www\drupal platform\sites\all\modules\Test
and inside this folder now we will create some module related files.
like -.info file, .install, .module,ModuleAction.php, ModuleView.php
it is important to define the id of the new module, for the reason it recognizes a module with its id.
do define name, description, package and core for that module.
core basically defines which drupal version are you using.
There is a choice - To make a Drupal website more of MVC architecture oriented in Place of PAC orieneted, we can introduce this concept of writing
an .xml file .
where you can define the title, action URL and function name etc.
also we will have to write a utility function to generate an array of these things out of XML file, to tell the controller that which function should be called when a particular URL is hit.
if you dont opt for this approach you will have to define this array of title, function name and URL etc same as its done in drupal modules.
Now we need to do a build and check it whether these URLs got registered in the menurouter table or not.
so Do a build and check your menu_router table, also check Actions.php there it should have defined the action name , url etc there also .
Now we need to go to URL like-
localhost/drupalwebsite/?q=admin/build/modules
Now our newly created module should be shown here, just check it to enable
and click on save configuartion.
once its done You can basically access other pages where those specific actions can be performed which you will be defining soon in .module file.
now go to .module file and well make sure that you have defined a hook_menu function.
and the other functions.
If you have done so, just say hurray! as you must be retreiving the function output while hitting the URL.
No comments:
Post a Comment