You are here

class EntityBundleInfo in Payment 8.2

Implements hook_entity_bundle_info().

Hierarchy

Expanded class hierarchy of EntityBundleInfo

See also

payment_entity_bundle_info()

1 file declares its use of EntityBundleInfo
EntityBundleInfoTest.php in tests/src/Unit/Hook/EntityBundleInfoTest.php
1 string reference to 'EntityBundleInfo'
payment.services.yml in ./payment.services.yml
payment.services.yml
1 service uses EntityBundleInfo
payment.hook.entity_bundle_info in ./payment.services.yml
Drupal\payment\Hook\EntityBundleInfo

File

src/Hook/EntityBundleInfo.php, line 12

Namespace

Drupal\payment\Hook
View source
class EntityBundleInfo {

  /**
   * The payment method configuration manager.
   *
   * @var \Drupal\Component\Plugin\PluginManagerInterface
   */
  protected $paymentMethodConfigurationManager;

  /**
   * The payment type manager
   *
   * @var \Drupal\Component\Plugin\PluginManagerInterface
   */
  protected $paymentTypeManager;

  /**
   * Constructs a new instance.
   *
   * @param \Drupal\Component\Plugin\PluginManagerInterface $payment_type_manager
   * @param \Drupal\Component\Plugin\PluginManagerInterface $payment_method_configuration_manager
   */
  public function __construct(PluginManagerInterface $payment_type_manager, PluginManagerInterface $payment_method_configuration_manager) {
    $this->paymentMethodConfigurationManager = $payment_method_configuration_manager;
    $this->paymentTypeManager = $payment_type_manager;
  }

  /**
   * Invokes the implementation.
   */
  public function invoke() {
    $bundles = [];
    foreach ($this->paymentTypeManager
      ->getDefinitions() as $plugin_id => $definition) {
      $bundles['payment'][$plugin_id] = array(
        'label' => $definition['label'],
      );
    }
    foreach ($this->paymentMethodConfigurationManager
      ->getDefinitions() as $plugin_id => $definition) {
      $bundles['payment_method_configuration'][$plugin_id] = array(
        'label' => $definition['label'],
      );
    }
    return $bundles;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityBundleInfo::$paymentMethodConfigurationManager protected property The payment method configuration manager.
EntityBundleInfo::$paymentTypeManager protected property The payment type manager
EntityBundleInfo::invoke public function Invokes the implementation.
EntityBundleInfo::__construct public function Constructs a new instance.