You are here

public function SalesforceExampleSubscriber::pushAllowed in Salesforce Suite 8.3

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

SalesforcePushAllowedEvent callback.

Parameters

\Drupal\salesforce_mapping\Event\SalesforcePushAllowedEvent $event: The push allowed event.

File

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

Class

SalesforceExampleSubscriber
Class SalesforceExampleSubscriber.

Namespace

Drupal\salesforce_example\EventSubscriber

Code

public function pushAllowed(SalesforcePushAllowedEvent $event) {

  /** @var \Drupal\Core\Entity\Entity $entity */
  $entity = $event
    ->getEntity();
  if ($entity && $entity
    ->getEntityTypeId() == 'unpushable_entity') {
    $event
      ->disallowPush();
  }
}