You are here

protected function PropertiesExtended::getStringValue in Salesforce Suite 8.3

Helper Method to check for and retrieve field data.

If it is just a regular field/property of the entity, the data is retrieved with ->value(). If this is a property referenced using the typed_data module's extension, use typed_data module's DataFetcher class to retrieve the value.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to search the Typed Data for.

string $drupal_field_value: The Typed Data property to get.

Return value

string The String representation of the Typed Data property value.

1 call to PropertiesExtended::getStringValue()
PropertiesExtended::value in modules/salesforce_mapping/src/Plugin/SalesforceMappingField/PropertiesExtended.php
Given a Drupal entity, return the outbound value.

File

modules/salesforce_mapping/src/Plugin/SalesforceMappingField/PropertiesExtended.php, line 329

Class

PropertiesExtended
Adapter for entity properties and fields.

Namespace

Drupal\salesforce_mapping\Plugin\SalesforceMappingField

Code

protected function getStringValue(EntityInterface $entity, $drupal_field_value) {
  try {
    return $this
      ->getDataFetcher()
      ->fetchDataByPropertyPath($entity
      ->getTypedData(), $drupal_field_value)
      ->getString();
  } catch (\Exception $e) {
    return NULL;
  }
}