You are here

public function SalesforceExampleSubscriber::pushAllowed in Salesforce Suite 5.0.x

Same name and namespace in other branches
  1. 8.4 modules/salesforce_example/src/EventSubscriber/SalesforceExampleSubscriber.php \Drupal\salesforce_example\EventSubscriber\SalesforceExampleSubscriber::pushAllowed()
  2. 8.3 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 33

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();
  }
}