Thursday, January 20, 2011

Drupal in NetBeans

Where to get it: http://drupalmodules.com/module/netbeans-templates

No this isn't a Drupal module, but where would something like this live otherwise? :) It's a collection of templates used within NetBeans and makes coding must faster. There are quite a few templates and it can take some time to figure them out, but the author did a good job using some naming conventions. For example, "h_menu" will insert a full template for hook_menu resulting in:

function mymodule_menu(){

  $items = array();

  $items['path'] = array(
      'title' => 'title',
      'description' => 'description',
      'page callback' => 'callback',
      'page arguments' => array('callback_arg'),
      'access arguments' => array('access_arg'),
      'file' => 'includes/mymodule_type.inc',
  ); 
 
  return $items;


}

After the template is inserted, mymodule is automatically selected and ready to be edited to the actual name of your module.

Installation instructions (as of NB 6.9):
  1. Rename nb_templates.zip.txt to nb_templates.zip
  2. In NetBeans, goto Tools > Options > Editor > Code Templates  and press the import button at the bottom.
  3. Browse and find nb_templates.zip, and select it.
  4. Select Editor > Code Templates
  5. Press OK

A must have for NetBeans users.

Friday, January 7, 2011

Module: AdminRole

Module Page: http://drupal.org/project/adminrole
Drupal Version Support:
  • 6.x -> YES
  • 7.x -> Included
From the module page:
This module is a little helper to maintain an administrator role which has all available permissions. By default, Drupal only has one super user and this module helps improve this drastically.

One of the first things many Drupal developers do when they create a new site is to create a role called "administrator" or something along those lines so that users other than User1 can do administrative tasks.  However, as soon as a new module or content type is added, you must go into permissions and enable the permissions for your custom admin role.   With the AdminRole module, you can select which role should be give these permissions by default.

HowTo:
  1. First make sure you create your administrator role.  "Admin" is just fine for a name and takes up a lot less space than "Administrator" on the permissions page.
  2. Once you've downloaded and enabled the module, goto User Management->User Settings and scroll to the bottom.  You should see something similar to this:
  3. Now just select the role you want to automatically assign new permissions to, and Save. 
This is one of the modules I include with every make file!!!.  And now it is included in D7, so sweet!