class TargetDefinition in Feeds 8.3
A generic target definition.
Hierarchy
- class \Drupal\feeds\TargetDefinition implements TargetDefinitionInterface
Expanded class hierarchy of TargetDefinition
2 files declare their use of TargetDefinition
- TargetDefinitionTest.php in tests/
src/ Unit/ TargetDefinitionTest.php - Temporary.php in src/
Feeds/ Target/ Temporary.php
File
- src/
TargetDefinition.php, line 8
Namespace
Drupal\feedsView source
class TargetDefinition implements TargetDefinitionInterface {
/**
* The definition label.
*
* @var string
*/
protected $label;
/**
* The definition description.
*
* @var string
*/
protected $description;
/**
* The definition properties.
*
* @var array
*/
protected $properties = [];
/**
* The unique properties.
*
* @var array
*/
protected $unique = [];
/**
* {@inheritdoc}
*/
public static function create() {
return new static();
}
/**
* {@inheritdoc}
*/
public function getPluginId() {
return $this->pluginId;
}
/**
* {@inheritdoc}
*/
public function setPluginId($plugin_id) {
$this->pluginId = $plugin_id;
return $this;
}
/**
* {@inheritdoc}
*/
public function getLabel() {
return $this->label;
}
/**
* Sets the target definition label.
*
* @param string $label
* The label.
*
* @return $this
*/
public function setLabel($label) {
$this->label = $label;
return $this;
}
/**
* {@inheritdoc}
*/
public function getDescription() {
return $this->description;
}
/**
* Sets the target definition description.
*
* @param string $description
* The description.
*
* @return $this
*/
public function setDescription($description) {
$this->description = $description;
return $this;
}
/**
* {@inheritdoc}
*/
public function hasProperty($property) {
return isset($this->properties[$property]);
}
/**
* {@inheritdoc}
*/
public function getProperties() {
return array_keys($this->properties);
}
/**
* {@inheritdoc}
*/
public function getPropertyLabel($property) {
return $this->properties[$property]['label'];
}
/**
* {@inheritdoc}
*/
public function getPropertyDescription($property) {
return $this->properties[$property]['description'];
}
/**
* {@inheritdoc}
*/
public function isUnique($property) {
return isset($this->unique[$property]);
}
/**
* Adds a supported property.
*
* @param string $property
* The supported property.
* @param string $label
* (optional) The label of the property. Defaults to an empty string.
* @param string $description
* (optional) The description of the property. Defaults to an empty string.
*
* @return $this
*/
public function addProperty($property, $label = '', $description = '') {
$this->properties[$property] = [
'label' => $label,
'description' => $description,
];
return $this;
}
/**
* Marks a property as unique.
*
* @param string $property
* The property to mark as unique.
*
* @return $this
*/
public function markPropertyUnique($property) {
$this->unique[$property] = TRUE;
return $this;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
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 description. Overrides TargetDefinitionInterface:: |
1 |
TargetDefinition:: |
public | function |
Returns the target label. Overrides TargetDefinitionInterface:: |
1 |
TargetDefinition:: |
public | function |
Returns the target plugin id. Overrides TargetDefinitionInterface:: |
|
TargetDefinition:: |
public | function |
Returns the list of properties. Overrides TargetDefinitionInterface:: |
|
TargetDefinition:: |
public | function |
Returns the description for a given property. Overrides TargetDefinitionInterface:: |
1 |
TargetDefinition:: |
public | function |
Returns the label for a given property. Overrides TargetDefinitionInterface:: |
1 |
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. | |
TargetDefinition:: |
public | function | 1 |