Posts

Showing posts from July, 2013

Drupal - Hiding field group and its Children

It came to me when I was trying to hide field_group on account page. Searching on I found the following solution using hook_form_alter // Comment /** * Implements hook_form_FORM_ID_alter(). */ function MODULE_form_node_form_alter(&$form, &$form_state) { global $user; // The 'internal' field groups should only be accessible for regional administrators. if (!in_array('regional administrator', $user->roles)) { foreach (array('group_action_internal', 'group_company_internal', 'group_topic_internal') as $fieldgroup) { if (isset($form['#fieldgroups'][$fieldgroup]) && isset($form['#group_children'])) { // Hide the field group itself. $form['#fieldgroups'][$fieldgroup]->format_type = 'hidden'; // Hide the elements inside the field group. foreach ($form['#group_children'] as $field => $group) { if ($group == $fieldgroup) {

Some Useful Drush Commands

Downloading modules:  $ drush dl module_name It will automaticly download extracted module to modules folder in your project. Enabling modules: $ drush en module_name Disabling modules: $ drush pm-disable module_name Unistalling modules: $ drush pm-uninstall module_name Clear Cache:  You can use the following command to clear all cache of your site. $ drush cc all List modules: $ drush pm-list --type=module And if you want to list only non core modules, you can use $ drush pm-list --type=module --no-core --pipe SQL dump: $ drush sql-dump > filename.sql It will automatically take the dump of the database of the project in which you are. status (st) Check the Status: Provides a birds-eye view of the current Drupal installation, if any. $ drush status Check the Recent Watchdog:  To list the recent watch dog status, us the following. $ drush ws ws referes to Watchdog show. Database connection detail: Provides a birds-eye view o

Installing Drupal - On Lamp

Here we will see how to install Drupal on a LAMP environment. We can do it using two ways, one is downloading it manulay and other is install it using DRUSH.(We will see how to install drush in next sections.) Downloading and Extracting Drupal  You can download latest Drupal by going to https://drupal.org/project/drupal are by using any utility. Here we will be using wget in shell. wget http://ftp.drupal.org/files/projects/drupal-x.x.tar.gz You can replace x.x with the version you want to download. For example.. wget http://ftp.drupal.org/files/projects/drupal-7.22.tar.gz Now time to exteact the file you just downloaded. tar -zxvf drupal-7.22.tar.gz After extracting you can move files in drupal-7.22.tar.gz directory one level "up" into the web server's document root or your public HTML directory. mv drupal-7.22/* /var/www/local.mysite.com/docroot NOTE: In your web server's configuration file the base URL for your Drupal installation wil