You are here

public function TransactorBase::isApplicable in Transaction 8

Check if the transactor is applicable to a particular entity.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The content entity to check.

\Drupal\transaction\TransactionTypeInterface $transaction_type: (optional) Restrict the checking to a particular transaction type.

Return value

bool TRUE if transactor is applicable to the given entity.

Overrides TransactorPluginInterface::isApplicable

File

src/TransactorBase.php, line 793

Class

TransactorBase
Provides a base class for transactor plugins.

Namespace

Drupal\transaction

Code

public function isApplicable(ContentEntityInterface $entity, TransactionTypeInterface $transaction_type = NULL) {
  $result = TRUE;
  if (!empty($this->pluginDefinition['supported_entity_types'])) {
    $result = in_array($entity
      ->getEntityTypeId(), $this->pluginDefinition['supported_entity_types']);
  }
  return $result;
}