class SocialMediaLinksFieldMapping in Webform Content Creator 3.x
Provides social media links field mapping.
Plugin annotation
@WebformContentCreatorFieldMapping(
id = "social_media_links_mapping",
label = @Translation("Social media links"),
weight = 0,
field_types = {
"social_media_links_field"
},
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\webform_content_creator\Plugin\FieldMappingBase implements FieldMappingInterface
- class \Drupal\webform_content_creator\Plugin\WebformContentCreator\FieldMapping\SocialMediaLinksFieldMapping
- class \Drupal\webform_content_creator\Plugin\FieldMappingBase implements FieldMappingInterface
Expanded class hierarchy of SocialMediaLinksFieldMapping
File
- src/
Plugin/ WebformContentCreator/ FieldMapping/ SocialMediaLinksFieldMapping.php, line 23
Namespace
Drupal\webform_content_creator\Plugin\WebformContentCreator\FieldMappingView source
class SocialMediaLinksFieldMapping extends FieldMappingBase {
public function getEntityComponentFields(FieldDefinitionInterface $field_definition) {
$platforms = $field_definition
->getSetting("platforms");
$available_platforms = [];
foreach ($platforms as $key => $platform) {
if ($platform['enabled'] == 1) {
$available_platforms[] = $key;
}
}
return $available_platforms;
}
public function getSupportedWebformFields($webform_id) {
$supported_types = FieldMappingInterface::WEBFORM_TEXT_ELEMENTS;
return $this
->filterWebformFields($webform_id, $supported_types);
}
public function mapEntityField(ContentEntityInterface &$content, array $webform_element, array $data = [], FieldDefinitionInterface $field_definition) {
$field_data = [];
$field_id = $field_definition
->getName();
foreach ($data as $key => $value) {
$field_data[$key] = [
'value' => $value,
];
}
$content
->set($field_id, [
'platform_values' => $field_data,
]);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FieldMappingBase:: |
protected | function | ||
FieldMappingBase:: |
public | function | Get the field types this plugin is available for. | |
FieldMappingBase:: |
public | function | Get the plugin ID. | |
FieldMappingBase:: |
public | function | Get the plugin label. | |
FieldMappingBase:: |
public | function | Return the plugin. | |
FieldMappingBase:: |
public | function | Get the plugin weight. | |
FieldMappingBase:: |
public | function | Is this a generic (non-element specific) plugin. | |
FieldMappingBase:: |
public | function |
Returns whether the mapper supports custom field text Overrides FieldMappingInterface:: |
2 |
FieldMappingInterface:: |
constant | |||
FieldMappingInterface:: |
constant | |||
FieldMappingInterface:: |
constant | |||
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
2 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
PluginBase:: |
public | function | Constructs a \Drupal\Component\Plugin\PluginBase object. | 98 |
SocialMediaLinksFieldMapping:: |
public | function |
Returns the entity component fields. Overrides FieldMappingBase:: |
|
SocialMediaLinksFieldMapping:: |
public | function |
Overrides FieldMappingBase:: |
|
SocialMediaLinksFieldMapping:: |
public | function |
Use a single mapping to set an entity field value. Overrides FieldMappingBase:: |