You are here

public function DrupalConstant::pullValue in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 5.0.x modules/salesforce_mapping/src/Plugin/SalesforceMappingField/DrupalConstant.php \Drupal\salesforce_mapping\Plugin\SalesforceMappingField\DrupalConstant::pullValue()

Pull callback for field plugins.

This callback is overloaded to serve 2 different use cases.

  • Use case 1: primitive values If pullValue() returns a primitive value, callers will attempt to set the value directly on the parent entity.
  • Use case 2: typed data If pullValue() returns a TypedDataInterface, callers will assume the implementation has set the appropriate value(s). The returned TypedData will be issued to a SalesforceEvents::PULL_ENTITY_VALUE event, but will otherwise be ignored.

Parameters

\Drupal\salesforce\SObject $sf_object: The SFObject being pulled.

\Drupal\Core\Entity\EntityInterface $entity: The entity being pulled.

\Drupal\salesforce_mapping\Entity\SalesforceMappingInterface $mapping: The mapping.

Return value

\Drupal\Core\TypedData\TypedDataInterface|mixed If a TypedDataInterface is returned, validate constraints and use TypedDataManager to set the value on the root entity. Otherwise, set the value directly via FieldableEntityInterface::set

Overrides SalesforceMappingFieldPluginBase::pullValue

File

modules/salesforce_mapping/src/Plugin/SalesforceMappingField/DrupalConstant.php, line 98

Class

DrupalConstant
Adapter for entity Constant and fields.

Namespace

Drupal\salesforce_mapping\Plugin\SalesforceMappingField

Code

public function pullValue(SObject $sf_object, EntityInterface $entity, SalesforceMappingInterface $mapping) {
  return $this
    ->config('drupal_constant');
}