You are here

protected function PropertiesBase::getDataValue in Salesforce Suite 5.0.x

Same name and namespace in other branches
  1. 8.4 modules/salesforce_mapping/src/Plugin/SalesforceMappingField/PropertiesBase.php \Drupal\salesforce_mapping\Plugin\SalesforceMappingField\PropertiesBase::getDataValue()

Another helper Method to check for and retrieve field data.

Same as getStringValue(), but returns the typed data prior to stringifying.

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

\Drupal\Core\TypedData\TypedDataInterface|NULL The array representation of the Typed Data property value.

2 calls to PropertiesBase::getDataValue()
PropertiesBase::getStringValue in modules/salesforce_mapping/src/Plugin/SalesforceMappingField/PropertiesBase.php
Helper Method to check for and retrieve field data.
PropertiesBase::value in modules/salesforce_mapping/src/Plugin/SalesforceMappingField/PropertiesBase.php
Given a Drupal entity, return the outbound value.

File

modules/salesforce_mapping/src/Plugin/SalesforceMappingField/PropertiesBase.php, line 239

Class

PropertiesBase
Base class for properties plugins.

Namespace

Drupal\salesforce_mapping\Plugin\SalesforceMappingField

Code

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