Used by ITLS during development of a website.
PHP JavaScript CSS Other
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Drupal Module: Loft Dev

Author: Aaron Klump


Provides a suite of development tools for Drupal.



  1. Install as usual, see for further information.


  1. You most likely want to add the following line to settings.local.php. This will insure that the dev tools appear on every page, for every role, regardless of permissions. The alternative is to setup roles for the permission loft_dev:use tools.

    $conf['loft_dev_free_access'] = TRUE;

Hide Admin Stuff

  1. Hold down the meta key when clicking Hide Admin Stuff for a 3 minute hide.
  2. Extend the admin stuff selectors using hook_loft_dev_admin_stuff().


Load a view mode with all fields hidden, weights & labels reset

In order to make this work you will first have to disable any Display Suite layout that is chosen for the view mode!

Append ?resetto the url of the view mode edit page and refresh

These options available are:

query param desctiption
&label= above

Example usage:


Troubleshooting mail issues

If you set the variable loft_dev_mail_capture to 1, emails will be written to private://loft-dev/mail and you can see the emails that are being sent. They will not be actually sent while this is true. See loft_dev_mail_alter() and loft_dev_exit() for more info.

Database Schema Rollbacks

You can easily rollback the module version using the loft dev tools block "Replay Update" button. By default the schema will be rolled back by one number. You can also target a specific rollback number by setting the following variable to the schema version you want to rollback to:

drush vset loft_dev:update_rollback_{module name} {schema version, e.g. 7004}

Automatic backups using Loft Deploy

Loft Dev module can automatically call loft_deploy export on regulary intervals of use. This has the effect of automatically backing up the database to the normal output path, for every N minutes of active use. For the most recent backup go there. To see the incremental backups in time, descend into the loft_dev_auto directory.

This is not based on cron, but rather on elapsed time. If you set this to back up every 15 minutes, it will only do so if you're activaly using the site. It's like poor man's cron, it looks to see if N minutes has elapsed since the last backup, and it does this on a page load. Thus, no use, no page load. The following settings needed to be added to settings.local.php.

To disable this feature set it to 0.

$conf['loft_dev_which_ld'] = '/Volumes/Data/Users/aklump/bin/loft_deploy';
$conf['loft_dev_loft_deploy_export_period_mins'] = 5;

You may also need to add the following to .loft_deploy/config


Integration with drupal_deploy

Add the somthing like the following to your settings file so the current deploy folder can be located:

$conf['loft_dev_drupal_deploy_path'] = realpath(DRUPAL_ROOT . '/../drupal_deploy/user/deploy_2.0');

Sandbox (on ?sb or off ?sb=0)

Sandbox mode is activated by appending to the query string. What you append, depends upon what you've provided in the hook callback. When you active this mode, the file that is provided in the hook will be called after a full bootstrap; use it to test code without having to change paths.

Theme Playground Templates (on ?pg or off ?pg=0)

For rapid development, a feature exists called the theme playground where you can swap out flat file versions of your tpl files. This is good when your content is not ready, or you just want to try out a different version of a tpl file.

  1. In your active theme, create tpl variations following this pattern {theme}--loft-dev-playground.tpl.php, e.g., html--loft-dev-playground.tpl.php.

  2. Activate these templates by either visiting the playground url /loft-dev/theme/playgroundor by appending ?pg to the query string at any path. When activated, these template files will be used instead of the normal ones.

Hardcoded data/variables

Normally template variables are provided by the database and other functions. You can hardcode variable values for your templates using files in a folder called loft_dev_playground.

  1. In your active theme, create a folder called loft_dev_playground.
  2. In this folder place files that contain values, e.g. page.content.php. The filename is important as it maps to a php array like this:

    page.content.php -> $page['content'] -> $page['foo']['bar']['baz']

  3. The value of the variable is whatever is printed by that file, e.g.

    <?php /**

    • @file
    • Provides a hardcoded variable for $page['content'] *
    • This file is named page.content.php */ ?>

      This is the value of the variable

  4. Or it could also be something like this:

    <?php /**

    • @file
    • Provides a hardcoded variable for $page['content'] *
    • This file is named page.content.php */ $build['item_list'] = array( '#theme' => 'item_list', '#items' => array('do', 're', 'mi'), '#type' => 'ol', ); print render($build);
  5. Append ?ldp_data to any url to load content from the theme directory loft_dev_playground. Alternately, you may set a system var and content will be pulled always, so long as the file contains something; set this var:

    $conf['loft_dev_playground_load_data'] = TRUE;

  • You can also disable by adding ldp_data=0 to the url.
  • See hook_loft_dev_playground_info.

  1. You can ignore certain files without having to delete them by using a file loft_dev_playground/config.json, e.g.:

    { "ignore": [ "page.content.php" ] }


  • In the Loft Studios
  • Aaron Klump - Developer
  • PO Box 29294 Bellingham, WA 98228-1294
  • aim: theloft101
  • skype: intheloftstudios
  • d.o: aklump