You are here

function panopoly_theme_update_7003 in Panopoly Theme 7

Switch all Panels in the database to use Radix layouts.

File

./panopoly_theme.install, line 63
An installation file for Panopoly Theme

Code

function panopoly_theme_update_7003() {
  $panopoly_layouts = array(
    'bartlett',
    'bartlett_flipped',
    'boxton',
    'brenham',
    'brenham_flipped',
    'brown',
    'bryant',
    'bryant_flipped_flipped',
    'burr',
    'burr_flipped',
    'geary',
    'harris',
    'hewston',
    'hewston_flipped',
    'mccoppin',
    'moscone',
    'moscone_flipped',
    'phelan',
    'pond',
    'rolph',
    'sanderson',
    'sanderson_flipped',
    'selby',
    'selby_flipped',
    'sutro',
    'sutro_double',
    'taylor',
    'taylor_flipped',
    'webb',
    'webb_flipped',
    'whelan',
  );
  $results = db_select('panels_display', 'pd')
    ->fields('pd', array(
    'did',
    'layout',
  ))
    ->execute();
  foreach ($results as $display) {
    if (in_array($display->layout, $panopoly_layouts)) {

      // Work around misnamed layout.
      if ($display->layout == 'bryant_flipped_flipped') {
        $display->layout = 'bryant_flipped';
      }
      db_update('panels_display')
        ->fields(array(
        'layout' => 'radix_' . $display->layout,
      ))
        ->condition('did', $display->did)
        ->execute();
    }
  }
}