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
Specifically it looks like:
- Copy your live database.
- Edit your page manager page in the UI.
- drush site-deploy-export PageManager PAGE_MACHINE_NAME
- Create a hook_update_N in your deploy module or page manager feature that looks like
- Commit the export file and hook_update_n to your repository.
- 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.
$message = HookUpdateDeployTools\PageManager::import('PAGE_MACHINE_NAME');
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.