class SmartDate in Smart Date 3.0.x
Same name and namespace in other branches
- 8.2 src/Feeds/Target/SmartDate.php \Drupal\smart_date\Feeds\Target\SmartDate
- 3.x src/Feeds/Target/SmartDate.php \Drupal\smart_date\Feeds\Target\SmartDate
- 3.1.x src/Feeds/Target/SmartDate.php \Drupal\smart_date\Feeds\Target\SmartDate
- 3.2.x src/Feeds/Target/SmartDate.php \Drupal\smart_date\Feeds\Target\SmartDate
- 3.3.x src/Feeds/Target/SmartDate.php \Drupal\smart_date\Feeds\Target\SmartDate
- 3.4.x src/Feeds/Target/SmartDate.php \Drupal\smart_date\Feeds\Target\SmartDate
Defines a smartdate field mapper.
Plugin annotation
@FeedsTarget(
id = "smart_date_feeds_target",
field_types = {"smartdate"}
)
Hierarchy
- class \Drupal\smart_date\Feeds\Target\SmartDate extends \Drupal\feeds\Plugin\Type\Target\FieldTargetBase
Expanded class hierarchy of SmartDate
File
- src/
Feeds/ Target/ SmartDate.php, line 19
Namespace
Drupal\smart_date\Feeds\TargetView source
class SmartDate extends FieldTargetBase {
/**
* {@inheritdoc}
*/
protected static function prepareTarget(FieldDefinitionInterface $field_definition) {
return FieldTargetDefinition::createFromFieldDefinition($field_definition)
->addProperty('value')
->addProperty('end_value');
}
/**
* {@inheritdoc}
*/
protected function prepareValue($delta, array &$values) {
if (isset($values)) {
if (isset($values['value']) && !isset($values['end_value'])) {
$values['end_value'] = $values['value'];
}
return $values;
}
else {
throw new EmptyFeedException();
}
}
/**
* {@inheritdoc}
*/
protected function prepareValues(array $values) {
$return = [];
foreach ($values as $delta => $columns) {
try {
$this
->prepareValue($delta, $columns);
$return[] = $columns;
} catch (EmptyFeedException $e) {
// Nothing wrong here.
} catch (TargetValidationException $e) {
// Validation failed.
\Drupal::messenger()
->addError($e
->getMessage());
}
}
return $return;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SmartDate:: |
protected static | function | ||
SmartDate:: |
protected | function | ||
SmartDate:: |
protected | function |