class FieldTargetDefinition in Feeds 8.3
Provides a field definition wrapped over a field definition.
Hierarchy
- class \Drupal\feeds\TargetDefinition implements TargetDefinitionInterface
- class \Drupal\feeds\FieldTargetDefinition
Expanded class hierarchy of FieldTargetDefinition
23 files declare their use of FieldTargetDefinition
- ConfigEntityReference.php in src/
Feeds/ Target/ ConfigEntityReference.php - DateRange.php in src/
Feeds/ Target/ DateRange.php - Email.php in src/
Feeds/ Target/ Email.php - EntityProcessorBase.php in src/
Feeds/ Processor/ EntityProcessorBase.php - EntityProcessorBaseTest.php in tests/
src/ Kernel/ Feeds/ Processor/ EntityProcessorBaseTest.php
File
- src/
FieldTargetDefinition.php, line 10
Namespace
Drupal\feedsView source
class FieldTargetDefinition extends TargetDefinition {
/**
* The target plugin id.
*
* @var string
*/
protected $pluginId;
/**
* The wrapped field definition.
*
* @var \Drupal\Core\Field\FieldDefinitionInterface
*/
protected $fieldDefinition;
/**
* Creates a target definition form a field definition.
*
* @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
* The field definition.
*
* @return \Drupal\feeds\FieldTargetDefinition
* A new target definition.
*/
public static function createFromFieldDefinition(FieldDefinitionInterface $field_definition) {
return static::create()
->setFieldDefinition($field_definition);
}
/**
* Sets the field definition.
*
* @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
* The field definition.
*
* @return $this
*/
protected function setFieldDefinition(FieldDefinitionInterface $field_definition) {
$this->fieldDefinition = $field_definition;
return $this;
}
/**
* Sets the plugin id.
*
* @param string $plugin_id
* The plugin id.
*
* @return $this
* An instance of itself.
*/
public function setPluginId($plugin_id) {
$this->pluginId = $plugin_id;
return $this;
}
/**
* Returns the field definition.
*
* @return \Drupal\Core\Field\FieldDefinitionInterface
* The wrapped field definition.
*/
public function getFieldDefinition() {
return $this->fieldDefinition;
}
/**
* {@inheritdoc}
*/
public function getLabel() {
return $this->fieldDefinition
->getLabel();
}
/**
* {@inheritdoc}
*/
public function getDescription() {
return $this->fieldDefinition
->getDescription();
}
/**
* {@inheritdoc}
*/
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);
}
/**
* {@inheritdoc}
*/
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);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FieldTargetDefinition:: |
protected | property | The wrapped field definition. | |
FieldTargetDefinition:: |
protected | property | The target plugin id. | |
FieldTargetDefinition:: |
public static | function | Creates a target definition form a field definition. | |
FieldTargetDefinition:: |
public | function |
Returns the target description. Overrides TargetDefinition:: |
|
FieldTargetDefinition:: |
public | function | Returns the field definition. | |
FieldTargetDefinition:: |
public | function |
Returns the target label. Overrides TargetDefinition:: |
|
FieldTargetDefinition:: |
public | function |
Returns the description for a given property. Overrides TargetDefinition:: |
|
FieldTargetDefinition:: |
public | function |
Returns the label for a given property. Overrides TargetDefinition:: |
|
FieldTargetDefinition:: |
protected | function | Sets the field definition. | |
FieldTargetDefinition:: |
public | function |
Sets the plugin id. Overrides TargetDefinition:: |
|
TargetDefinition:: |
protected | property | The definition description. | |
TargetDefinition:: |
protected | property | The definition label. | |
TargetDefinition:: |
protected | property | The definition properties. | |
TargetDefinition:: |
protected | property | The unique properties. | |
TargetDefinition:: |
public | function | Adds a supported property. | |
TargetDefinition:: |
public static | function |
Helper factory method. Overrides TargetDefinitionInterface:: |
|
TargetDefinition:: |
public | function |
Returns the target plugin id. Overrides TargetDefinitionInterface:: |
|
TargetDefinition:: |
public | function |
Returns the list of properties. Overrides TargetDefinitionInterface:: |
|
TargetDefinition:: |
public | function |
Returns whether this target has a given property. Overrides TargetDefinitionInterface:: |
|
TargetDefinition:: |
public | function |
Retuns whether a property is unique. Overrides TargetDefinitionInterface:: |
|
TargetDefinition:: |
public | function | Marks a property as unique. | |
TargetDefinition:: |
public | function | Sets the target definition description. | |
TargetDefinition:: |
public | function | Sets the target definition label. |