예제 #1
0
파일: User.php 프로젝트: atxajon/d8cafe
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $uid = $row->getSourceProperty('uid');
     // field_real_name
     $result = $this->getDatabase()->query('
   SELECT
     fld.field_real_name_value
   FROM
     {dcf_field_data_field_real_name} fld
   WHERE
     fld.entity_id = :uid
 ', array(':uid' => $uid));
     foreach ($result as $record) {
         $row->setSourceProperty('field_real_name', $record->field_real_name_value);
     }
     // field_availability
     $result = $this->getDatabase()->query('
   SELECT
     fld.field_availability_value
   FROM
     {dcf_field_data_field_availability} fld
   WHERE
     fld.entity_id = :uid
 ', array(':uid' => $uid));
     foreach ($result as $record) {
         $row->setSourceProperty('field_availability', $record->field_availability_value);
     }
     return parent::prepareRow($row);
 }
예제 #2
0
파일: MenuLink.php 프로젝트: aWEBoLabs/taxi
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $row->setSourceProperty('options', unserialize($row->getSourceProperty('options')));
     $row->setSourceProperty('enabled', !$row->getSourceProperty('hidden'));
     $row->setSourceProperty('description', Unicode::truncate($row->getSourceProperty('options/attributes/title'), 255));
     return parent::prepareRow($row);
 }
예제 #3
0
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $row->setSourceProperty('file_directory_path', $this->filePath);
     $row->setSourceProperty('temp_directory_path', $this->tempFilePath);
     $row->setSourceProperty('is_public', $this->isPublic);
     return parent::prepareRow($row);
 }
예제 #4
0
파일: Link.php 프로젝트: atxajon/d8cafe
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $nid = $row->getSourceProperty('nid');
     // taxonomy term IDs
     // (here we use MySQL's GROUP_CONCAT() function to merge all values into one row.)
     $result = $this->getDatabase()->query('
   SELECT
     GROUP_CONCAT(fld.field_links_tags_tid) as tids
   FROM
     {dcf_field_data_field_links_tags} fld
   WHERE
     fld.entity_id = :nid
 ', array(':nid' => $nid));
     foreach ($result as $record) {
         if (!is_null($record->tids)) {
             $row->setSourceProperty('tags', explode(',', $record->tids));
         }
     }
     // field_url
     $result = $this->getDatabase()->query('
   SELECT
     fld.field_url_url as url,
     fld.field_url_title as title
   FROM
     {dcf_field_data_field_url} fld
   WHERE
     fld.entity_id = :nid
 ', array(':nid' => $nid));
     foreach ($result as $record) {
         $row->setSourceProperty('field_url_url', $record->url);
         $row->setSourceProperty('field_url_title', $record->title);
     }
     return parent::prepareRow($row);
 }
예제 #5
0
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $filters = array();
     $roles = $row->getSourceProperty('roles');
     $row->setSourceProperty('roles', array_values(array_filter(explode(',', $roles))));
     $format = $row->getSourceProperty('format');
     // Find filters for this row.
     $results = $this->select('filters', 'f')->fields('f', array('module', 'delta', 'weight'))->condition('format', $format)->execute();
     foreach ($results as $raw_filter) {
         $module = $raw_filter['module'];
         $delta = $raw_filter['delta'];
         $filter = array('module' => $module, 'delta' => $delta, 'weight' => $raw_filter['weight'], 'settings' => array());
         // Load the filter settings for the filter module, modules can use
         // hook_migration_d6_filter_formats_prepare_row() to add theirs.
         if ($raw_filter['module'] == 'filter') {
             if (!$delta) {
                 if ($setting = $this->variableGet("allowed_html_{$format}", NULL)) {
                     $filter['settings']['allowed_html'] = $setting;
                 }
                 if ($setting = $this->variableGet("filter_html_help_{$format}", NULL)) {
                     $filter['settings']['filter_html_help'] = $setting;
                 }
                 if ($setting = $this->variableGet("filter_html_nofollow_{$format}", NULL)) {
                     $filter['settings']['filter_html_nofollow'] = $setting;
                 }
             } elseif ($delta == 2 && ($setting = $this->variableGet("filter_url_length_{$format}", NULL))) {
                 $filter['settings']['filter_url_length'] = $setting;
             }
         }
         $filters[] = $filter;
     }
     $row->setSourceProperty('filters', $filters);
     return parent::prepareRow($row);
 }
예제 #6
0
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $row->setSourceProperty('filename', basename($row->getSourceProperty('picture')));
     $row->setSourceProperty('file_directory_path', $this->filePath);
     $row->setSourceProperty('temp_directory_path', $this->tempFilePath);
     return parent::prepareRow($row);
 }
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $type = $row->getSourceProperty('type');
     $row->setSourceProperty('language_content_type', $this->variableGet('language_content_type_' . $type, NULL));
     $row->setSourceProperty('i18n_lock_node', $this->variableGet('i18n_lock_node_' . $type, 0));
     return parent::prepareRow($row);
 }
예제 #8
0
  /**
   * {@inheritdoc}
   */
  public function prepareRow(Row $row) {
    // User roles.
    $roles = $this->select('users_roles', 'ur')
      ->fields('ur', array('rid'))
      ->condition('ur.uid', $row->getSourceProperty('uid'))
      ->execute()
      ->fetchCol();
    $row->setSourceProperty('roles', $roles);

    // We are adding here the Event contributed module column.
    // @see https://api.drupal.org/api/drupal/modules%21user%21user.install/function/user_update_7002/7
    if ($row->hasSourceProperty('timezone_id') && $row->getSourceProperty('timezone_id')) {
      if ($this->getDatabase()->schema()->tableExists('event_timezones')) {
        $event_timezone = $this->select('event_timezones', 'e')
          ->fields('e', array('name'))
          ->condition('e.timezone', $row->getSourceProperty('timezone_id'))
          ->execute()
          ->fetchField();
        if ($event_timezone) {
          $row->setSourceProperty('event_timezone', $event_timezone);
        }
      }
    }

    // Unserialize Data.
    $row->setSourceProperty('data', unserialize($row->getSourceProperty('data')));

    return parent::prepareRow($row);
  }
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $data = unserialize($row->getSourceProperty('data'));
     $row->setSourceProperty('widget', $data['widget']);
     $row->setSourceProperty('widget_settings', $data['widget']['settings']);
     return parent::prepareRow($row);
 }
예제 #10
0
  /**
   * {@inheritdoc}
   */
  public function prepareRow(Row $row) {
    // Find profile values for this row.
    $query = $this->select('profile_values', 'pv')
      ->fields('pv', array('fid', 'value'));
    $query->leftJoin('profile_fields', 'pf', 'pf.fid=pv.fid');
    $query->fields('pf', array('name', 'type'));
    $query->condition('uid', $row->getSourceProperty('uid'));
    $results = $query->execute();

    foreach ($results as $profile_value) {
      // Check special case for date. We need to unserialize.
      if ($profile_value['type'] == 'date') {
        $date = unserialize($profile_value['value']);
        $date = date('Y-m-d', mktime(0, 0, 0, $date['month'], $date['day'], $date['year']));
        $row->setSourceProperty($profile_value['name'], array('value' => $date));
      }
      elseif ($profile_value['type'] == 'list') {
        // Explode by newline and comma.
        $row->setSourceProperty($profile_value['name'], preg_split("/[\r\n,]+/", $profile_value['value']));
      }
      else {
        $row->setSourceProperty($profile_value['name'], array($profile_value['value']));
      }
    }

    return parent::prepareRow($row);
  }
예제 #11
0
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     // Find node types for this row.
     $node_types = $this->select('vocabulary_node_types', 'nt')->fields('nt', array('type', 'vid'))->condition('vid', $row->getSourceProperty('vid'))->execute()->fetchCol();
     $row->setSourceProperty('node_types', $node_types);
     $row->setSourceProperty('cardinality', $row->getSourceProperty('tags') == 1 || $row->getSourceProperty('multiple') == 1 ? FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED : 1);
     return parent::prepareRow($row);
 }
예제 #12
0
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     // Find parents for this row.
     $query = $this->select('wp_term_taxonomy', 'wptt')->fields('wptt', array('parent', 'term_id', 'taxonomy', 'description'))->condition('term_id', $row->getSourceProperty('term_id'))->execute()->fetchAssoc();
     $row->setSourceProperty('parent', $query['parent']);
     $row->setSourceProperty('description', $query['description']);
     $row->setSourceProperty('vid', $query['taxonomy']);
     return parent::prepareRow($row);
 }
예제 #13
0
파일: Role.php 프로젝트: ddrozdik/dmaps
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $rid = $row->getSourceProperty('rid');
     $permissions = $this->select('permission', 'p')->fields('p', array('perm'))->condition('rid', $rid)->execute()->fetchField();
     $row->setSourceProperty('permissions', explode(', ', $permissions));
     if (isset($this->filterPermissions[$rid])) {
         $row->setSourceProperty("filter_permissions:{$rid}", $this->filterPermissions[$rid]);
     }
     return parent::prepareRow($row);
 }
예제 #14
0
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     // Unserialize data.
     $widget_settings = unserialize($row->getSourceProperty('widget_settings'));
     $display_settings = unserialize($row->getSourceProperty('display_settings'));
     $global_settings = unserialize($row->getSourceProperty('global_settings'));
     $row->setSourceProperty('widget_settings', $widget_settings);
     $row->setSourceProperty('display_settings', $display_settings);
     $row->setSourceProperty('global_settings', $global_settings);
     return parent::prepareRow($row);
 }
예제 #15
0
파일: Comment.php 프로젝트: aWEBoLabs/taxi
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $cid = $row->getSourceProperty('cid');
     $node_type = $row->getSourceProperty('node_type');
     $comment_type = 'comment_node_' . $node_type;
     $row->setSourceProperty('comment_type', 'comment_node_' . $node_type);
     foreach (array_keys($this->getFields('comment', $comment_type)) as $field) {
         $row->setSourceProperty($field, $this->getFieldValues('comment', $field, $cid));
     }
     return parent::prepareRow($row);
 }
예제 #16
0
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row, $keep = TRUE)
 {
     // Unserialize data.
     $global_settings = unserialize($row->getSourceProperty('global_settings'));
     $widget_settings = unserialize($row->getSourceProperty('widget_settings'));
     $db_columns = unserialize($row->getSourceProperty('db_columns'));
     $row->setSourceProperty('global_settings', $global_settings);
     $row->setSourceProperty('widget_settings', $widget_settings);
     $row->setSourceProperty('db_columns', $db_columns);
     return parent::prepareRow($row);
 }
예제 #17
0
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $type = $row->getSourceProperty('type');
     $row->setSourceProperty('language_content_type', $this->variableGet('language_content_type_' . $type, NULL));
     $i18n_node_options = $this->variableGet('i18n_node_options_' . $type, NULL);
     if ($i18n_node_options && in_array('lock', $i18n_node_options)) {
         $row->setSourceProperty('i18n_lock_node', 1);
     } else {
         $row->setSourceProperty('i18n_lock_node', 0);
     }
     return parent::prepareRow($row);
 }
예제 #18
0
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $row->setSourceProperty('teaser_length', $this->teaserLength);
     $row->setSourceProperty('node_preview', $this->nodePreview);
     $type = $row->getSourceProperty('type');
     $options = $this->variableGet('node_options_' . $type, array('promote', 'sticky'));
     foreach (array('promote', 'sticky', 'status', 'revision') as $item) {
         $options[$item] = isset($options[$item]);
     }
     $row->setSourceProperty('options', $options);
     $submitted = isset($this->themeSettings['toggle_node_info_' . $type]) ? $this->themeSettings['toggle_node_info_' . $type] : FALSE;
     $row->setSourceProperty('submitted', $submitted);
     return parent::prepareRow($row);
 }
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     /**
      * Let's go get the subTeam taxonomy tid for each product
      */
     $start = $row->getSourceProperty('salestart');
     if (!is_null($start)) {
         //      drupal_set_message('start:' . $start) ;
         $timestamp = strtotime($start);
         $start = date("Y-m-d\\TH:i:s", $timestamp);
         //      drupal_set_message('reformatted start: ' . $start);
         $row->setSourceProperty('salestart', $start);
     }
     $end = $row->getSourceProperty('saleend');
     if (!is_null($end)) {
         //      drupal_set_message('end:' . $end);
         $timestamp = strtotime($start);
         $end = date("Y-m-d\\TH:i:s", $timestamp);
         //      drupal_set_message('reformatted end: ' . $end);
         $row->setSourceProperty('saleend', $end);
     }
     // Fill in the field_product_ref entity ref to the product node.
     $id = $row->getSourceProperty('identifier');
     $product_ref_id = $this->lookupProductNid($id);
     $row->setSourceProperty('product_ref_id', $product_ref_id);
     $tlc = $row->getSourceProperty('tlc');
     $store_ref_id = $this->lookupStoreNid($tlc);
     $row->setSourceProperty('store_ref_id', $store_ref_id);
     $ssid = $row->getSourceProperty('ssid');
     drupal_set_message('Processing: ' . $ssid);
     /**
      * As explained above, we need to pull the style relationships into our
      * source row here, as an array of 'style' values (the unique ID for
      * the beer_term migration).
      */
     //    $terms = $this->select('migrate_example_beer_topic_node', 'bt')
     //      ->fields('bt', ['style'])
     //      ->condition('bid', $row->getSourceProperty('bid'))
     //      ->execute()
     //      ->fetchCol();
     //    $row->setSourceProperty('terms', $terms);
     // As we did for favorite beers in the user migration, we need to explode
     // the multi-value country names.
     //    if ($value = $row->getSourceProperty('countries')) {
     //      $row->setSourceProperty('countries', explode('|', $value));
     //    }
     return parent::prepareRow($row);
     //  }
 }
예제 #20
0
파일: Member.php 프로젝트: atxajon/d8cafe
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $nid = $row->getSourceProperty('nid');
     // field_short_bio
     $result = $this->getDatabase()->query('
   SELECT
     fld.field_short_bio_value as bio
   FROM
     {dcf_field_data_field_short_bio} fld
   WHERE
     fld.entity_id = :nid
 ', array(':nid' => $nid));
     foreach ($result as $record) {
         $row->setSourceProperty('field_short_bio', $record->bio);
     }
     // field_image
     $result = $this->getDatabase()->query('
   SELECT
     fld.field_image_fid,
     fld.field_image_alt,
     fld.field_image_title,
     fld.field_image_width,
     fld.field_image_height
   FROM
     {dcf_field_data_field_image} fld
   WHERE
     fld.entity_id = :nid
 ', array(':nid' => $nid));
     // Create an associative array for each row in the result. The keys
     // here match the last part of the column name in the field table.
     $images = [];
     foreach ($result as $record) {
         $images[] = ['target_id' => $record->field_image_fid, 'alt' => $record->field_image_alt, 'title' => $record->field_image_title, 'width' => $record->field_image_width, 'height' => $record->field_image_height];
     }
     $row->setSourceProperty('field_image', $images);
     // field_linkedin_url
     $result = $this->getDatabase()->query('
   SELECT
     fld.field_linkedin_url_url as linkedin
   FROM
     {dcf_field_data_field_linkedin_url} fld
   WHERE
     fld.entity_id = :nid
 ', array(':nid' => $nid));
     foreach ($result as $record) {
         $row->setSourceProperty('field_linkedin_url_url', $record->linkedin);
     }
     return parent::prepareRow($row);
 }
예제 #21
0
파일: Comment.php 프로젝트: sarahwillem/OD8
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     if ($this->variableGet('comment_subject_field_' . $row->getSourceProperty('type'), 1)) {
         // Comment subject visible.
         $row->setSourceProperty('field_name', 'comment');
         $row->setSourceProperty('comment_type', 'comment');
     } else {
         $row->setSourceProperty('field_name', 'comment_no_subject');
         $row->setSourceProperty('comment_type', 'comment_no_subject');
     }
     // In D6, status=0 means published, while in D8 means the opposite.
     // See https://www.drupal.org/node/237636.
     $row->setSourceProperty('status', !$row->getSourceProperty('status'));
     return parent::prepareRow($row);
 }
예제 #22
0
 protected function transformEntityViewDisplaySettings(Row $row)
 {
     $row->setSourceProperty('extracted_settings', $row->getSourceProperty('settings/display'));
     $view_modes = array_diff(array_keys($row->getSourceProperty('extracted_settings')), ['label', 'description', 'weight']);
     $view_modes = array_filter($view_modes, function ($value) {
         return !is_numeric($value);
     });
     $row->setSourceProperty('view_mode_keys', $view_modes);
     $view_modes = [];
     foreach ($row->getSourceProperty('view_mode_keys') as $view_mode) {
         $source_settings = $row->getSourceProperty('extracted_settings/' . $view_mode);
         $row->setSourceProperty('view_modes', []);
         $settings = ['format_type' => 'details', 'format_settings' => []];
         switch ($source_settings['format']) {
             case 'no_style':
                 $settings['format_type'] = 'no_style';
                 break;
             case 'simple':
                 $settings['format_type'] = 'html_element';
                 $settings['format_settings']['element'] = 'div';
                 $settings['format_settings']['label_element'] = 'h2';
                 break;
             case 'fieldset':
                 $settings['format_type'] = 'fieldset';
                 break;
             case 'fieldset_collapsible':
                 $settings['format_type'] = 'details';
                 $settings['format_settings']['open'] = TRUE;
                 break;
             case 'fieldset_collapsed':
                 $settings['format_type'] = 'details';
                 $settings['format_settings']['open'] = FALSE;
                 break;
             case 'hidden':
                 $settings['format_type'] = 'hidden';
                 break;
         }
         /**
          * @todo: ?
          */
         if ($view_mode == 'full') {
             $view_mode = 'default';
         }
         // $row->setSourceProperty('view_modes/' . $view_mode, $settings);
         $view_modes[$view_mode] = $settings;
     }
     $row->setSourceProperty('view_modes', $view_modes);
 }
예제 #23
0
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     /**
      * As explained above, we need to pull the style relationships into our
      * source row here, as an array of 'style' values (the unique ID for
      * the ssd_term migration).
      */
     $terms = $this->select('migrate_example_ssd_topic_node', 'bt')->fields('bt', ['style'])->condition('bbid', $row->getSourceProperty('bbid'))->execute()->fetchCol();
     $row->setSourceProperty('terms', $terms);
     // As we did for favorite ssd in the user migration, we need to explode
     // the multi-value country names.
     if ($value = $row->getSourceProperty('countries')) {
         $row->setSourceProperty('countries', explode('|', $value));
     }
     return parent::prepareRow($row);
 }
예제 #24
0
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     // Find node types for this row.
     $node_types = $this->select('vocabulary_node_types', 'nt')->fields('nt', array('type', 'vid'))->condition('vid', $row->getSourceProperty('vid'))->execute()->fetchCol();
     $row->setSourceProperty('node_types', $node_types);
     return parent::prepareRow($row);
 }
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     // Select all related tickets (rnid) to the current ticket (nid)
     $query = $this->select('support_reference', 'sr')->fields('sr', array('rnid'))->condition('sr.nid', $row->getSourceProperty('nid'));
     $row->setSourceProperty('rnid', $query->execute()->fetchCol());
     return parent::prepareRow($row);
 }
예제 #26
0
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     if ($value = $row->getSourceProperty('value')) {
         $row->setSourceProperty('value', unserialize($value));
     }
     return parent::prepareRow($row);
 }
예제 #27
0
파일: Field.php 프로젝트: aWEBoLabs/taxi
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row, $keep = TRUE)
 {
     foreach (unserialize($row->getSourceProperty('data')) as $key => $value) {
         $row->setSourceProperty($key, $value);
     }
     return parent::prepareRow($row);
 }
예제 #28
0
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     $vocab = $row->getSourceProperty('taxonomy');
     $label = $vocab == 'category' ? 'Category' : 'Post Tags';
     $row->setSourceProperty('label', $label);
     return parent::prepareRow($row);
 }
예제 #29
0
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     /**
      * prepareRow() is the most common place to perform custom run-time
      * processing that isn't handled by an existing process plugin. It is called
      * when the raw data has been pulled from the source, and provides the
      * opportunity to modify or add to that data, creating the canonical set of
      * source data that will be fed into the processing pipeline.
      *
      * In our particular case, the list of a user's favorite ssds is a pipe-
      * separated list of ssd IDs. The processing pipeline deals with arrays
      * representing multi-value fields naturally, so we want to explode that
      * string to an array of individual ssd IDs.
      */
     if ($value = $row->getSourceProperty('ssds')) {
         $row->setSourceProperty('ssds', explode('|', $value));
     }
     /**
      * Always call your parent! Essential processing is performed in the base
      * class. Be mindful that prepareRow() returns a boolean status - if FALSE
      * that indicates that the item being processed should be skipped. Unless
      * we're deciding to skip an item ourselves, let the parent class decide.
      */
     return parent::prepareRow($row);
 }
예제 #30
0
파일: Term.php 프로젝트: nsp15/Drupal8
 /**
  * {@inheritdoc}
  */
 public function prepareRow(Row $row)
 {
     // Find parents for this row.
     $parents = $this->select('term_hierarchy', 'th')->fields('th', array('parent', 'tid'))->condition('tid', $row->getSourceProperty('tid'))->execute()->fetchCol();
     $row->setSourceProperty('parent', $parents);
     return parent::prepareRow($row);
 }