| Conditions | 4 |
| Paths | 6 |
| Total Lines | 22 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | public function prepareRow(Row $row) { |
||
| 23 | if ($image_path = $row->getSourceProperty('Headshot')) { |
||
| 24 | $path = dirname($this->configuration['path']) . '/images/' . $image_path; |
||
| 25 | |||
| 26 | $data = file_get_contents($path); |
||
| 27 | $uri = file_build_uri($image_path); |
||
| 28 | $file = file_save_data($data, $uri); |
||
| 29 | |||
| 30 | $row->setSourceProperty('Headshot', $file); |
||
| 31 | } |
||
| 32 | if ($value = $row->getSourceProperty('Links')) { |
||
| 33 | $links_raw = explode(',', $value); |
||
| 34 | $links = []; |
||
| 35 | foreach ($links_raw as $link) { |
||
| 36 | list($uri,$title) = explode('|', $link); |
||
| 37 | $links[] = [ |
||
| 38 | 'uri' => $uri, |
||
| 39 | 'title' => $title, |
||
| 40 | 'options' => array() |
||
| 41 | ]; |
||
| 42 | } |
||
| 43 | $row->setSourceProperty('Links', $links); |
||
| 44 | } |
||
| 48 |