EntityBundleInfo.php in Payment 8.2
File
src/Hook/EntityBundleInfo.php
View source
<?php
namespace Drupal\payment\Hook;
use Drupal\Component\Plugin\PluginManagerInterface;
class EntityBundleInfo {
protected $paymentMethodConfigurationManager;
protected $paymentTypeManager;
public function __construct(PluginManagerInterface $payment_type_manager, PluginManagerInterface $payment_method_configuration_manager) {
$this->paymentMethodConfigurationManager = $payment_method_configuration_manager;
$this->paymentTypeManager = $payment_type_manager;
}
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;
}
}