Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update #1

Merged
merged 7 commits into from Feb 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,15 @@
# Changelog

## 3.1.2 - 2019-02-02

### Changed
- Support `nesbot/carbon` `^1.22 || ^2.10`
- Support `league/csv` `^8.2 || ^9.0`

### Fixed
- `EVENT_BEFORE_PROCESS_FEED` process event can actually modify variables (thanks @monachilada).
- Always include a root node for primary element.

## 3.1.1 - 2019-02-01

### Added
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Expand Up @@ -2,7 +2,7 @@
"name": "verbb/feed-me",
"description": "Import content from XML, RSS, CSV or JSON feeds into Entries, Categories, Craft Commerce Products (and variants), and more.",
"type": "craft-plugin",
"version": "3.1.1",
"version": "3.1.2",
"keywords": [
"craft",
"cms",
Expand All @@ -29,8 +29,8 @@
"cakephp/core": "^3.5",
"cakephp/utility": "^3.3.12",
"jakeasmith/http_build_url": "^1.0",
"nesbot/carbon": "^2.10",
"league/csv": "^8.2",
"nesbot/carbon": "^1.22 || ^2.10",
"league/csv": "^8.2 || ^9.0",
"guzzlehttp/guzzle": "~6.3.0",
"vlucas/phpdotenv": "^2.4",
"ralouphie/mimey": "^1.0",
Expand Down
10 changes: 4 additions & 6 deletions src/services/DataTypes.php
Expand Up @@ -208,20 +208,18 @@ public function getFeedNodes($data)

$tree = [];
$this->_parseNodeTree($tree, $data);

$nodes = [];

$elements = (count($data) > 1) ? ' elements' : ' element';
$nodes[''] = '/root (x' . count($data) . $elements . ')';

foreach ($tree as $key => $value) {
$elements = ($value > 1) ? ' elements' : ' element';
$index = array_values(array_slice(explode('/', $key), -1))[0];

$nodes[$index] = $key . ' (x' . $value . $elements . ')';
}

if (empty($tree)) {
$elements = (count($data) > 1) ? ' elements' : ' element';
$nodes[''] = '/root (x' . count($data) . $elements . ')';
}

return $nodes;
}

Expand Down
4 changes: 2 additions & 2 deletions src/services/Process.php
Expand Up @@ -141,8 +141,8 @@ public function beforeProcessFeed($feed, $feedData)
}

// Allow event to modify variables
$feed = $event->feed;
$feedData = $event->feedData;
$this->_feed = $event->feed;
$this->_data = $event->feedData;

FeedMe::info('Finished preparing for feed processing.');

Expand Down