Created on 29 March 2019, about 5 years ago
Updated 2 May 2024, about 2 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

Needs work

Version

2.0

Component

Code

Created by

πŸ‡«πŸ‡·France perpignan

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.69.0 2024