Drupal Planet

Installing drush

Here are some commands for installing drush from the command line

sudo apt-get install php-pear
pear channel-discover pear.drush.org
pear install drush/drush
drush version
pear upgrade drush/drush

But this is the new preferred way using Composer on *nix

# install composer
curl -sS https://getcomposer.org/installer | php -- --install-dir=bin --filename=composer
# You may need to mkdir ~/bin first if you don't have one.

Images to scale or crop and aspect ratios

These are some help diagrams to assist people in understanding the basic image operations we can do with image cache styles.  There are lots of subtle things we can do, but the bulk of the decision always comes down to whether we should scale or crop.  The balance is this:

Taxonomy Term Display

In core there is a module called: Taxonomy display.

The module allows for the custom display of Drupal's default taxonomy term pages. The module is enabled upon installation.

To use the module, go into the "Manage Display" tab of the taxonomy term. Under Default display in the lower tabs, make sure "Taxonomy term page" is checked under "Use custom display settings for the following view modes and click on ". Then click save. Move to the "Taxonomy term page" display and customize the options there.

Importing an Excel (xls) File to Generate Nodes or Terms (Feeds)

Often we get issued an Excel spreadsheet of pages with names and description and need to import them into Drupal.  Here are the steps.

codit_memorytracker() - Tracking Memory use in a Drupal Script

Devel has some output that you can turn on to inspect script memory useage. In some cases (like batch processes) they may not give you what you need. Especially if you want to watch it while it is happening.

Here is a function that is part of the Codit module. Here are some sample ways to call this function.

Webform values for select options

There are two issues related to select options for Webform based forms.

codit_build_menu_list() - Generate a column list from a menu

If you need to make a multicolumn list from a Drupal menu (or even a vocabulary) this function allows you to do that.

codit_menu_or_array_as_select_list() - Generate a select list for a form.

It can take a menu or simply an array of items and build a select form element (not the entire form, just the select). It has the following features.

Overlay Independence

In Drupal 7 you seem to be sometimes stuck in that the media browser requires the "overlay" module to be enabled in order to work properly. This is due to the media browser relying on the jquery bbq library being added by the overlay module. You can always just add the library in your own module or tpl.


Subscribe to RSS - Drupal Planet