feeds-8.x-3.0-alpha1/src/Feeds/Target/Path.php
src/Feeds/Target/Path.php
<?php
namespace Drupal\feeds\Feeds\Target;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\feeds\FieldTargetDefinition;
use Drupal\feeds\Plugin\Type\Target\FieldTargetBase;
/**
* Defines a path field mapper.
*
* @FeedsTarget(
* id = "path",
* field_types = {"path"}
* )
*/
class Path extends FieldTargetBase {
/**
* {@inheritdoc}
*/
protected static function prepareTarget(FieldDefinitionInterface $field_definition) {
return FieldTargetDefinition::createFromFieldDefinition($field_definition)
->addProperty('alias');
}
/**
* {@inheritdoc}
*/
protected function prepareValue($delta, array &$values) {
$values['alias'] = trim($values['alias']);
}
}
