Deploy Drupal Page Manager Pages - Hands Free

Page Manager pages in Drupal 7 are an odd mixture of configuration and content. They can be Featurized, but then if someone edits the content on the live site, the next time the Feature gets reverted, the content changes get blown away. So in many cases the deployment of Page Manager Pages consists of exporting them by hand, then importing them by hand. Until NOW.

The module Hook Update Deploy Tools (v 7.x-1.12) can now export Ctools Page Manger pages to a text file with a Drush command and then import them inside a hook_update_N().  This makes a deployment automated and testable, without tangling a Page Manager page up in a Feature.

The deployment flow is pretty simple

Pull db, Make changes to page, export with drush, import with update hook.


Specifically it looks like:

  1. Copy your live database.
  2. Edit your page manager page in the UI.
  3. drush site-deploy-export PageManager PAGE_MACHINE_NAME
  4. Create a hook_update_N in your deploy module or page manager feature that looks like
  5. <?php
    $message = HookUpdateDeployTools\PageManager::import('PAGE_MACHINE_NAME');
  6. Commit the export file and hook_update_n to your repository.
  7. When the code is deployed to a new server run 'drush updb', or better yet have Jenkins do it. The page manager page will be imported/updated and a nice message will be output and logged to show that it succeeded, or an exception will be thrown if there was a problem.

Hook Deploy Update Tools takes care of saving the Page Manager export file in the right spot and using it for importing page on deployment.