You are here

public function SocialMediaLinksFieldMapping::mapEntityField in Webform Content Creator 3.x

Use a single mapping to set an entity field value.

Overrides FieldMappingBase::mapEntityField

File

src/Plugin/WebformContentCreator/FieldMapping/SocialMediaLinksFieldMapping.php, line 43

Class

SocialMediaLinksFieldMapping
Provides social media links field mapping.

Namespace

Drupal\webform_content_creator\Plugin\WebformContentCreator\FieldMapping

Code

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,
  ]);
}