FieldTargetDefinition.php in Feeds 8.3
File
src/FieldTargetDefinition.php
View source
<?php
namespace Drupal\feeds;
use Drupal\Core\Field\FieldDefinitionInterface;
class FieldTargetDefinition extends TargetDefinition {
protected $pluginId;
protected $fieldDefinition;
public static function createFromFieldDefinition(FieldDefinitionInterface $field_definition) {
return static::create()
->setFieldDefinition($field_definition);
}
protected function setFieldDefinition(FieldDefinitionInterface $field_definition) {
$this->fieldDefinition = $field_definition;
return $this;
}
public function setPluginId($plugin_id) {
$this->pluginId = $plugin_id;
return $this;
}
public function getFieldDefinition() {
return $this->fieldDefinition;
}
public function getLabel() {
return $this->fieldDefinition
->getLabel();
}
public function getDescription() {
return $this->fieldDefinition
->getDescription();
}
public function getPropertyLabel($property) {
if (!empty($this->properties[$property]['label'])) {
return $this->properties[$property]['label'];
}
$property_definition = $this->fieldDefinition
->getItemDefinition()
->getPropertyDefinition($property);
return $property_definition ? $property_definition
->getLabel() : parent::getPropertyLabel($property);
}
public function getPropertyDescription($property) {
if (!empty($this->properties[$property]['description'])) {
return $this->properties[$property]['description'];
}
$property_definition = $this->fieldDefinition
->getItemDefinition()
->getPropertyDefinition($property);
return $property_definition ? $property_definition
->getDescription() : parent::getPropertyDescription($property);
}
}