Download, Install and Use NetBeans Plugin for Drupal ...

draindecorumΛογισμικό & κατασκευή λογ/κού

15 Αυγ 2012 (πριν από 5 χρόνια και 1 μήνα)

396 εμφανίσεις

Download, Install and Use NetBeans Plugin for

Drupal Support
-- Sujit Nair
-- Manisha Birajdar
(31/12/08)
This document will help the users to download, install and use the plugin. Before moving on

to the steps, if you already have the previous version of this plugin installed in your

NetBeans IDE, you will have to first uninstall it and later install the recent release. In this

case,
* In NetBeans IDE, go to
Tools --> Plugins --> Installed
tab
.
You will notice the previous

release of Drupal Module plugin. Select it and click on uninstall. You will have to restart the

NetBeans IDE to apply the changes. Once, done with this, proceed with the steps below.
Table of Contents
1.
Installing the plugin

2.
Using Wizard to create a new Drupal Module

3.
Using palette based code snippets to generate template code for hooks

4.
Using Wizard to create a new Drupal Theme

Installing the plugin :
Please follow the following steps for installing nbdrupalsupportv1.1 plugin :
1. Go to
http://nbdrupalsupport.dev.java.net/
Go to
Documents & files --> nbdrupalsupport --> Plugin
. Now, download the plugin

file,
nbdrupalsupportv1.1
by right clicking on it. Save it to a local folder on your hard

disk. The following screenshot captures these steps.
2. Now, run an instance of NetBeans IDE (preferably 6.5, in 6.1, its available as a Early

release for PHP). Go to
Tools --> Plugins --> Downloaded
. Click on
Add Plugin
and locate

the local folder wherein the plugin was downloaded. Select the ‘nbm’ file and click on

Open. Now, click install. These steps are captured in the screenshot below .
Please note, while installing, there is a warning thrown stating that the plugin is not signed

and may not be secured! Please ignore the warning message and click on continue.
Thus, the plugin is now installed into your IDE.

Using Wizard to create a new Drupal Module
The wizard assists to create a new Drupal module, generating the mandatory

<modulename>.info and <modulename>.module files along with <modulename>.install file

which can be removed if not required. Also, template code for some basic hooks like block,

help, install and uninstall are provided in these files.
The following are the steps to create a new Drupal module, using the wizard.
1. Open the Drupal project which has the Drupal sources attached to it. If the project is not

yet created, please follow the steps provided in the document at location
Documents & Files --> nbdrupalsupport --> Documentation --> nbdrupaldoc
(
http://nbdrupalsupport.dev.java.net
)
to download the sources, add it to a PHP project,

configure and host with Apache Web Server, all from NetBeans IDE.
Right click on this project to add a module. Click on
New --> Other
. Select
Other
and we

see an option to create a Drupal Module. Select it and click on Next.
These steps are captured in the screenshot below.
2. In the next screen, enter the module name (preferably in small letters, as per the

naming convention). We see, the new files, viz.,
<modulename>.info
and

<modulename>.module
and
<modulename>.install
getting enlisted in generated files list.

The following screenshot captures this.
Click on Finish.
3. Now, the new module gets added to the Drupal modules and the three files get

autogenerated with template code, as shown in screenshots below :
Thus, now we can add further code and fill in the data to create a Drupal Module.
Using palette based code snippets to generate template code for hooks
For the ease of generating the template code for any hook in the module or install file,

components have been provided in the palette corresponding to these type (PHP) of files.

We can drag the components provided in the palette onto the editor for generating a

Drupal library based hook or an user-defined one.
The following are the steps to use the palette components for Drupal :
1. Open <modulename>.module or <modulename>.install, wherever a hook is to be

created. Now, in the IDE, click on Window --> Palette (Ctrl+Shift+8). You will observe a

component for creating Drupal hooks as seen in the screenshot below :
2. Now, If you want to create a Drupal library based hook, double click on the component

“Library Hook” or drag it onto position in the file wherein you want to generate the hook.
A window pops up and now select a hook from the list of all available hooks in Drupal 6.

Click on ok. You will see the 'function_hook()' gets generated with corresponding

parameters and template code, if any. The screenshots below demonstrate the same.
3. If you want to create your own hook, double click on the component “User-defined

Hook” or drag it onto position in the file wherein you want to generate the hook.
A window pops up and now enter the name of hook and its description . Click on ok. You

will see the 'function_hook()' gets generated with template code and comments. All this as

per the Drupal coding standards. The screenshots below demonstrate the same.
Thus, without caring much about hook templates, the developers can directly jump over to

implementation part of function. Hope this helps!
Using Wizard to create a new Drupal Theme
The wizard assists to create a new Drupal theme, generating the mandatory

<themename>.info
The following are the steps to create a new Drupal theme, using the wizard.
1. Open the Drupal project which has the Drupal sources attached to it. If the project is not

yet created, please follow the steps provided in the document at location
Documents & Files --> nbdrupalsupport --> Documentation --> nbdrupaldoc
(
http://nbdrupalsupport.dev.java.net
)
to download the sources, add it to a PHP project,

configure and host with Apache Web Server, all from NetBeans IDE.
Right click on this project to add a module. Click on
New --> Other
. Select
Other
and we

see an option to create a Drupal Theme. Select it and click on Next.
These steps are captured in the screenshot below.
2. In the next screen, enter the theme name (preferably in small letters, as per the naming

convention). We see the new file,
<themename>.info
getting enlisted in generated files

list. The following screenshot captures this.
Click on Finish.
3. Now, the new theme gets added to the Drupal themes and the info file gets

autogenerated with template code, as shown in screenshots below :
Thus, we see the wizard assists in generating folders and mandatory info file in a theme.

Also, if the 'themes' folder doesn't exist under '/sites/all', it gets generated. Now, the user

can go ahead with creating a theme, either by deriving from a base theme and modifying

the css/template files accordingly, or creating a new theme using a theme engine. As

Drupal provides PHPTemplate Theme Engine by default with the Drupal sources, user can

create the template php files required for the 5 components and create a new theme.
For any further queries, please feel free to mail
me
.