forked from Islandora-Devops/migrate_7x_claw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPathInfo.php
47 lines (39 loc) · 963 Bytes
/
PathInfo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
namespace Drupal\migrate_7x_claw\Plugin\migrate_plus\data_parser;
use Drupal\migrate\MigrateException;
use Drupal\migrate_plus\DataParserPluginBase;
/**
* Obtain pathinfo() data for files.
*
* @DataParser(
* id = "pathinfo",
* title = @Translation("Path Info")
* )
*/
class PathInfo extends DataParserPluginBase {
/**
* Path info results on the url.
*
* @var array
*/
protected $path_info;
public function __construct(array $configuration, $plugin_id, $plugin_definition) {
$configuration['item_selector'] = '';
parent::__construct($configuration, $plugin_id, $plugin_definition);
}
/**
* {@inheritdoc}
*/
protected function openSourceUrl($url) {
$this->path_info = pathinfo($url);
$this->path_info['fullpath'] = $url;
return TRUE;
}
/**
* {@inheritdoc}
*/
protected function fetchNextRow() {
$this->currentItem = $this->path_info;
$this->path_info = NULL;
}
}