- πΊπΈUnited States troybthompson
Were you able to figure this out? I'm trying to do the same.
How do I add feeds importer support for the image caption.
Here is how feeds add support for Alt and Title text.
<?php
namespace Drupal\feeds\Feeds\Target;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\feeds\FieldTargetDefinition;
/**
* Defines a file field mapper.
*
* @FeedsTarget(
* id = "image",
* field_types = {"image"}
* )
*/
class Image extends File {
/**
* {@inheritdoc}
*/
protected static function prepareTarget(FieldDefinitionInterface $field_definition) {
return FieldTargetDefinition::createFromFieldDefinition($field_definition)
->addProperty('target_id')
->addProperty('alt')
->addProperty('title');
}
/**
* {@inheritdoc}
*/
protected function prepareValue($delta, array &$values) {
foreach ($values as $column => $value) {
switch ($column) {
case 'target_id':
$values[$column] = $this->getFile($value);
break;
default:
$values[$column] = (string) $value;
break;
}
}
}
}
what is the ->addProperty();
Active
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Were you able to figure this out? I'm trying to do the same.