GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — 7.x-1.x ( 94dab8...029788 )
by Devin
03:44
created

DFSlideshowFPP::prepareRow()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
cc 3
eloc 9
c 3
b 0
f 1
nc 3
nop 1
dl 0
loc 14
rs 9.4285
1
<?php
2
3
/**
4
 * @file
5
 *  Migrations for Fieldable Panel Panes.
6
 */
7
8
class DFSlideshowFPP extends Migration {
9
10
  public function __construct($arguments) {
11
    parent::__construct($arguments);
12
    $this->description = t('Import Slideshow FPPs.');
13
14
    // Create a map object for tracking the relationships between source rows
15
    $this->map = new MigrateSQLMap($this->machineName,
16
      array(
17
        'UUID' => array(
18
          'type' => 'varchar',
19
          'length' => 36,
20
          'not null' => FALSE,
21
          'description' => 'The Universally Unique Identifier.',
22
        )
23
      ),
24
      array(
25
        'uuid' => array(
26
          'type' => 'varchar',
27
          'length' => 36,
28
          'not null' => FALSE,
29
          'description' => 'The Universally Unique Identifier.',
30
        )
31
      )
32
    );
33
34
    // Create a MigrateSource object.
35
    if (isset($arguments['path'])) {
36
      $import_path = $arguments['path'];
37
    }
38
    else {
39
      $import_path = drupal_get_path('module', 'df_tools_slideshow') . '/import/df_tools_slideshow.fpp.slideshow.csv';
40
    }
41
    $this->source = new MigrateSourceCSV($import_path, array(), array('header_rows' => 1));
42
    $this->destination = new MigrateDestinationFieldablePanelsPanes('slideshow', array('text_format' => 'raw_html'));
43
44
    $this->addFieldMapping('field_media', 'media_formatted');
45
    $this->addFieldMapping('field_media:file_replace')->defaultValue(FILE_EXISTS_REPLACE);
46
    $this->addFieldMapping('field_media:source_dir')->defaultValue(dirname($import_path) . '/images');
47
    $this->addFieldMapping('field_media:destination_file', 'filename');
48
49
    $this->addFieldMapping('field_title', 'title_formatted');
50
    $this->addFieldMapping('field_body', 'body_formatted');
51
52
    $this->addFieldMapping('title', 'Title');
53
    $this->addFieldMapping('uuid', 'UUID');
54
    $this->addFieldMapping('category', 'Category')->defaultValue('Reusable panes');
55
56
    $this->addFieldMapping('reusable', 'Reusable')->defaultValue(TRUE);
57
  }
58
59
  public function prepareRow($row) {
60
    $row->media_formatted = array();
61
    $row->title_formatted = array();
62
    $row->body_formatted = array();
63
    foreach ($row as $column => $value) {
64
      // Check to see if this is a slide field column
65
      if (strpos($column, 'Slide ') === 0) {
66
        // Slide columns are in the format "Slide <index> <Field>"
67
        $column = explode(' ', $column);
68
        $row->{strtolower($column[2]) . '_formatted'}[$column[1]] = $value;
69
      }
70
    }
71
    return TRUE;
72
  }
73
74
}
75