Created on 29 March 2019, about 6 years ago
Updated 9 September 2024, 7 months ago

A new file in src/Feeds/Target/Time.php perhaps for feeds ... i'm open to suggestion

<?php

namespace Drupal\time_field\Feeds\Target;

use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\feeds\FieldTargetDefinition;
use Drupal\feeds\Plugin\Type\Target\FieldTargetBase;

/**
* Defines a time field mapper.
*
* @FeedsTarget(
* id = "time_feeds_target",
* field_types = {"time"}
* )
*/
class Time extends FieldTargetBase {

/**
* {@inheritdoc}
*/
protected static function prepareTarget(FieldDefinitionInterface $field_definition) {
return FieldTargetDefinition::createFromFieldDefinition($field_definition)
->addProperty('value');
}

/**
* {@inheritdoc}
*/
protected function prepareValue($delta, array &$values) {
if (is_object($values['value']))
{
dpm($values['value']->getTimestamp());
$values['value'] = $values['value']->getTimestamp();
}
}

}

πŸ’¬ Support request
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡«πŸ‡·France perpignan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024