You are here

public function SalesforceExampleSubscriber::pushParamsAlter in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 8.3 modules/salesforce_example/src/EventSubscriber/SalesforceExampleSubscriber.php \Drupal\salesforce_example\EventSubscriber\SalesforceExampleSubscriber::pushParamsAlter()
  2. 5.0.x modules/salesforce_example/src/EventSubscriber/SalesforceExampleSubscriber.php \Drupal\salesforce_example\EventSubscriber\SalesforceExampleSubscriber::pushParamsAlter()

SalesforcePushParamsEvent callback.

Parameters

\Drupal\salesforce_mapping\Event\SalesforcePushParamsEvent $event: The event.

File

modules/salesforce_example/src/EventSubscriber/SalesforceExampleSubscriber.php, line 47

Class

SalesforceExampleSubscriber
Class SalesforceExampleSubscriber.

Namespace

Drupal\salesforce_example\EventSubscriber

Code

public function pushParamsAlter(SalesforcePushParamsEvent $event) {
  $mapping = $event
    ->getMapping();
  $mapped_object = $event
    ->getMappedObject();
  $params = $event
    ->getParams();

  /** @var \Drupal\Core\Entity\Entity $entity */
  $entity = $event
    ->getEntity();
  if ($entity
    ->getEntityTypeId() != 'user') {
    return;
  }
  if ($mapping
    ->id() != 'salesforce_example_contact') {
    return;
  }
  if ($mapped_object
    ->isNew()) {
    return;
  }
  $params
    ->setParam('FirstName', 'SalesforceExample');
}