Skip to content

Instantly share code, notes, and snippets.

View travisbutterfield's full-sized avatar

Travis Butterfield travisbutterfield

  • Arizona State University
  • Mesa, Arizona
View GitHub Profile
@travisbutterfield
travisbutterfield / config-deploy.md
Last active May 11, 2022 21:47
Workflow for deploying config changes in D9

Workflow for deploying config changes in D9

/* This workflow assumes you have installed Drush and have downloaded Pantheon site aliases with terminus aliases */

  1. Set bash variable: SITE=<sitename>
  2. Clone your LIVE environment to DEV in Pantheon terminus env:clone-content --updatedb -- $SITE.live dev (Optional, but recommended)
  3. Commit all LOCAL changes in Git.
  4. Export configs on LOCAL: drush config:export
  5. Commit changes on LOCAL: git commit -am "export local configs to code"
  6. Pull remote changes from LIVE to LOCAL: drush config:pull @$SITE.live @self:../config/
  7. Resolve any conflicts and then commit on LOCAL: git commit -am "resolve config code conflicts"
  8. Push changes up to remote DEV: git push origin

Connecting separate Lando containers for migration

Using some of the information from this article, and information from a few other sources, I have come up with a procedure for connecting two separate local Lando containers for Drupal 7 to Drupal 9 migration work.

  1. Create your Drupal 7 container from the source. In this case, we will be using a Pantheon-based website.
  2. Create your new Webspark 2 (Drupal 9) site in Pantheon.
  3. Install and enable modules in the new D9 site. (If you want to migrate content from D7 that is related to a module in any way, you will have to install that module in your D9 site, or the Migrate API won’t k

Connecting separate DDEV containers for migration

Using some of the information from this article, and information from a few other sources, I have come up with a procedure for connecting two separate local DDEV containers for Drupal 7 to Drupal 9 migration work.

  1. Create your Drupal 7 container from the source. In this case, we will be using a Pantheon-based website.
  2. Create your new Webspark 2 (Drupal 9) site in Pantheon.
  3. Install and enable modules in the new D9 site. (If you want to migrate content from D7 that is related to a module in any way, you will have to install that module in your D9 site, or the Migrate API won’t know to include it.)
    • Use Compo
@travisbutterfield
travisbutterfield / hook_node_access_example.php
Last active July 24, 2018 00:24
An example of the code to place in a custom module for limiting access to a specific content type, in this case the "custom content type" content type.
<?php
/**
* Implement hook_node_access().
*/
// Add perms to the custom_content_type content type
function HOOK_node_access($node, $op, $account) {
$type = is_string($node) ? $node : $node->type;
if ($type == 'custom_content_type' && $op == 'view') {