-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from SU-SWS/capx-tamper-rebase
HSDO-641 CAPx Tamper Functionality
- Loading branch information
Showing
13 changed files
with
1,447 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?php | ||
/** | ||
* @file | ||
* CAPx Tamper classes to fake feeds importer. | ||
*/ | ||
|
||
use \CAPx\Drupal\Entities\CFEntity; | ||
|
||
/** | ||
* Class CapxTamper. | ||
*/ | ||
class CapxTamper { | ||
|
||
/** | ||
* Mapper to use for processing. | ||
* | ||
* @var CFEntity | ||
*/ | ||
public $mapper; | ||
public $parser; | ||
public $processor; | ||
|
||
/** | ||
* CapxTamper constructor. | ||
* | ||
* @param \CAPx\Drupal\Entities\CFEntity $mapper | ||
* Mapper in use. | ||
*/ | ||
public function __construct(CFEntity $mapper, CapxTamperParser $parser, CapxTamperProcessor $processor) { | ||
$this->mapper = $mapper; | ||
$this->parser = $parser; | ||
$this->processor = $processor; | ||
} | ||
|
||
} | ||
|
||
/** | ||
* Class CapxTamperParser. | ||
*/ | ||
class CapxTamperParser { | ||
|
||
/** | ||
* Simulates FeedsCSVParser::getMappingSources(). | ||
* | ||
* @return bool | ||
* Similar to FeedsCSVParser | ||
*/ | ||
public function getMappingSources() { | ||
return FALSE; | ||
} | ||
|
||
} | ||
|
||
/** | ||
* Class CapxTamperProcessor. | ||
*/ | ||
class CapxTamperProcessor { | ||
|
||
/** | ||
* Mapper to use for processing. | ||
* | ||
* @var CFEntity | ||
*/ | ||
public $mapper; | ||
|
||
/** | ||
* CapxTamperProcessor constructor. | ||
* | ||
* @param CFEntity $mapper | ||
* CAPx Mapper to use. | ||
*/ | ||
public function __construct(CFEntity $mapper) { | ||
$this->mapper = $mapper; | ||
} | ||
|
||
/** | ||
* Passes the available sources & targets. | ||
* | ||
* @return array | ||
* Available sources. | ||
*/ | ||
public function getMappings() { | ||
$mapper_sources = capx_tamper_get_mapper_sources($this->mapper); | ||
$sources = array(); | ||
foreach ($mapper_sources as $target => $path) { | ||
$sources[] = array( | ||
'source' => $path, | ||
'target' => $target, | ||
'unique' => FALSE, | ||
'language' => LANGUAGE_NONE, | ||
); | ||
} | ||
return $sources; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Stanford CAPx Tampers | ||
#### Version 2.0-dev | ||
|
||
CAPx Tampers provide the option to alter the data from the API before saving it to a profile. Much of this functionality is inspired by the feeds_tamper module and additional help can be found at that resource. | ||
|
||
## Installation | ||
|
||
Install this module like [any other Drupal module](https://www.drupal.org/documentation/install/modules-themes/modules-7). | ||
|
||
## Configuration | ||
|
||
When enabled please first create a mapper. After the mapper has been created there will be an additional link titled 'Tampers' under the actions in the mapper list page. (/admin/config/capx/mappers). Click on the 'Tampers' link and choose from the options available to create your tampers. | ||
|
||
## Troubleshooting | ||
|
||
If you are experiencing issues with this module try reverting the feature first. If you are still experiencing issues try posting an issue on the GitHub issues page. | ||
|
||
## Contribution / Collaboration | ||
|
||
You are welcome to contribute functionality, bug fixes, or documentation to this module. If you would like to suggest a fix or new functionality you may add a new issue to the GitHub issue queue or you may fork this repository and submit a pull request. For more help please see [GitHub's article on fork, branch, and pull requests](https://help.github.com/articles/using-pull-requests) |
Oops, something went wrong.