Richard Castera - Explorations in Software Development
Richard Castera - Explorations in Software Development
Browsing Tag
drupal
Resources Scripts Web Server

Drupal – How to install Drush

August 27, 2010 3 Comments

What is Drush?

It’s a command line shell and scripting interface for Drupal. The Drush Package Manager allows you to download, enable, disable, uninstall, update modules/themes/profiles/translations from the command line in a very simple way (apt-get style) – just type,

1
drush dl views

and

1
drush pm-enable views

in a Drupal directory to install the Views project! Additionally, the Drush Package Manager also allows you to update all your modules and even Drupal core with just one command,

Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Drupal – Check if a User has a specific role

March 4, 2010 1 Comment

Here is a quick way to determine if a user has a specific role:

PHP
1
2
3
4
5
6
7
8
<?php
  // Bring the user object into scope.
  global $user;
  // Check to see if $user has the administrator user role.
  if (in_array('administrator', array_values($user->roles))) {
    // Do something.
  }
?>
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Drupal – Adding Javascript to your module

March 3, 2010 1 Comment

When creating your own Drupal module, you may need to add some styling or Javascript to improve the usability of your module. Here is how to do it.

PHP
1
drupal_add_js(drupal_get_path('module', 'MODULE_NAME') . '/common.js');

Similarly you can add CSS to your module as well

PHP
1
drupal_add_css(drupal_get_path('module', 'MODULE_NAME') . '/styles.css');
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Drupal – Use hook_form_alter() to set redirect path on the form

March 2, 2010 2 Comments

One popular use of this hook is to change the destination of a form submission. Here is how it is accomplished:

PHP
1
2
3
4
5
6
7
8
9
10
11
<?php
function YOURMODULE_form_alter($form_id, &$form) {
  switch ($form['#id']) {
    case 'node-form':
       if ($form['type']['#value'] == 'story') {
         $form['#redirect'] = 'new/url';
       }
     break;
  }
}
?>
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts Thoughts

Drupal – The Best and my Favorite Modules

August 9, 2009 2 Comments

I’ve worked with Drupal in the past for several projects and have come across some modules that have become my favorites. Here they are:

Continue reading
Reading time: 2 min
Share:
Written by: rcastera

About me

Hello, my name is Richard Castera. I have more than 12 years of experience architecting, implementing, leading and launching large scale, high performance software products in a fast-paced agile environment.

Popular Posts

Magento – Display new products on the home page

May 20, 2009

How to Fix “Internet Explorer Cannot Open the Internet Site- Operation Aborted” Error

May 9, 2009

PHP – Convert Array to Object with stdClass

July 5, 2009

Categories

  • Home Automation
  • Resources
  • Scripts
  • SEO
  • Thoughts
  • Web Server

Tags

Apache Apple Bash CSS Drupal Free home automation htaccess Java Javascript Magento PHP raspberry pi SEO SQL thoughts Wordpress

© 2019 copyright Richard Castera // All rights reserved