You are here

function uuid_features_features_pipe_uuid_fpp_alter in UUID Features Integration 7

Implements hook_features_pipe_COMPONENT_alter().

When exporting a Panel, include any attached Fieldable Panels Panes.

File

./uuid_features.module, line 261
UUID Features module allows to export data stored in the db by features.

Code

function uuid_features_features_pipe_uuid_fpp_alter(&$pipe, $data, $export) {
  $fpp_uuids = array();
  foreach ($export['features'] as $component => $feature) {
    if ($component == 'page_manager_pages') {
      $page_name = key($feature);
      $handlers = db_select('page_manager_handlers', 'pmh')
        ->fields('pmh', array(
        'did',
      ))
        ->condition('subtask', $page_name)
        ->execute()
        ->fetchAll();
      foreach ($handlers as $handler) {
        $display_id = $handler->did;
        $panes = db_select('panels_pane', 'pp')
          ->fields('pp', array(
          'subtype',
        ))
          ->condition('type', 'fieldable_panels_pane')
          ->condition('did', $display_id)
          ->execute()
          ->fetchAll();
        foreach ($panes as $pane) {
          $fpp_uuids[] = str_replace('uuid:', '', $pane->subtype);
        }
      }
    }
    elseif ($component == 'panels_mini') {
      $panel_name = key($feature);
      $display_id = db_select('panels_mini', 'pm')
        ->fields('pm', array(
        'did',
      ))
        ->condition('name', $panel_name)
        ->execute()
        ->fetchField();
      if (empty($display_id)) {
        continue;
      }
      $panes = db_select('panels_pane', 'pp')
        ->fields('pp', array(
        'subtype',
      ))
        ->condition('type', 'fieldable_panels_pane')
        ->condition('did', $display_id)
        ->execute()
        ->fetchAll();
      foreach ($panes as $pane) {
        $fpp_uuids[] = str_replace('uuid:', '', $pane->subtype);
      }
    }
  }
  $pipe['uuid_fpp'] = $fpp_uuids;
}