Conditions | 2 |
Paths | 2 |
Total Lines | 39 |
Code Lines | 26 |
Lines | 39 |
Ratio | 100 % |
Changes | 3 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
10 | public function __construct($arguments) { |
||
11 | parent::__construct($arguments); |
||
12 | $this->description = t('Import Text 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_fpp') . '/import/df_tools_fpp.text.csv'; |
||
40 | } |
||
41 | $this->source = new MigrateSourceCSV($import_path, array(), array('header_rows' => 1)); |
||
42 | $this->destination = new MigrateDestinationFieldablePanelsPanes('text', array('text_format' => 'full_html')); |
||
43 | |||
44 | $this->addFieldMapping('field_basic_text_text', 'HTML'); |
||
45 | $this->addFieldMapping('title', 'Title'); |
||
46 | $this->addFieldMapping('uuid', 'UUID'); |
||
47 | $this->addFieldMapping('category', 'Category')->defaultValue('Add text'); |
||
48 | } |
||
49 | |||
51 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.