CheckoutFlowManager.php in Commerce Core 8.2
File
modules/checkout/src/CheckoutFlowManager.php
View source
<?php
namespace Drupal\commerce_checkout;
use Drupal\Component\Plugin\Exception\PluginException;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
class CheckoutFlowManager extends DefaultPluginManager {
protected $defaults = [
'id' => '',
'label' => '',
];
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
parent::__construct('Plugin/Commerce/CheckoutFlow', $namespaces, $module_handler, 'Drupal\\commerce_checkout\\Plugin\\Commerce\\CheckoutFlow\\CheckoutFlowInterface', 'Drupal\\commerce_checkout\\Annotation\\CommerceCheckoutFlow');
$this
->alterInfo('commerce_checkout_flow_info');
$this
->setCacheBackend($cache_backend, 'commerce_checkout_flow_plugins');
}
public function processDefinition(&$definition, $plugin_id) {
parent::processDefinition($definition, $plugin_id);
foreach ([
'id',
'label',
] as $required_property) {
if (empty($definition[$required_property])) {
throw new PluginException(sprintf('The checkout flow %s must define the %s property.', $plugin_id, $required_property));
}
}
}
}