You are here

public function CommerceProductScheduler::getTypes in Scheduler 2.x

Get the available types/bundles for the entity type.

Do not use static or drupal_static here, because changes to third-party settings invalidate the saved values during phpunit testing.

Return value

array The commerce product bundle objects, keyed by bundle name, or an empty array if Commerce is not enabled.

Overrides SchedulerPluginBase::getTypes

1 call to CommerceProductScheduler::getTypes()
CommerceProductScheduler::entityFormIds in src/Plugin/Scheduler/CommerceProductScheduler.php
Get the form IDs for commerce product add/edit forms.

File

src/Plugin/Scheduler/CommerceProductScheduler.php, line 37

Class

CommerceProductScheduler
Plugin for Commerce Product entity type.

Namespace

Drupal\scheduler\Plugin\Scheduler

Code

public function getTypes() {
  if (!\Drupal::moduleHandler()
    ->moduleExists('commerce')) {
    return [];
  }
  $productTypes = \Drupal::entityTypeManager()
    ->getStorage('commerce_product_type')
    ->loadMultiple();
  return $productTypes;
}