public function TransactionType::getBundles in Transaction 8
Gets the bundles of the target entity type.
Parameters
bool $applicable: (optional) If TRUE, get all the applicable bundles if none set.
Return value
string[] An array containing the applicable bundles. Empty array if none set and $applicable is FALSE (default), or all existent bundles for the target entity type if none was set and $applicable is TRUE.
Overrides TransactionTypeInterface::getBundles
1 call to TransactionType::getBundles()
- TransactionType::isApplicable in src/
Entity/ TransactionType.php - Check if the type of transaction is applicable to a particular entity.
File
- src/
Entity/ TransactionType.php, line 124
Class
- TransactionType
- Provides a type of transaction.
Namespace
Drupal\transaction\EntityCode
public function getBundles($applicable = FALSE) {
$bundles = $this->bundles;
if (empty($bundles) && $applicable) {
// If the setting is empty, return all bundle names for the target entity
// type.
/** @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface $bundle_info_service */
$bundle_info_service = \Drupal::service('entity_type.bundle.info');
$bundle_info = $bundle_info_service
->getBundleInfo($this->target_entity_type);
$bundles = array_keys($bundle_info);
}
return $bundles;
}