class OrderFieldsPaneDeriver in Commerce Checkout Order Fields 8
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\commerce_checkout_order_fields\Plugin\Derivative\OrderFieldsPaneDeriver implements ContainerDeriverInterface
Expanded class hierarchy of OrderFieldsPaneDeriver
File
- src/
Plugin/ Derivative/ OrderFieldsPaneDeriver.php, line 10
Namespace
Drupal\commerce_checkout_order_fields\Plugin\DerivativeView source
class OrderFieldsPaneDeriver extends DeriverBase implements ContainerDeriverInterface {
/**
* The base plugin ID this derivative is for.
*
* @var string
*/
protected $basePluginId;
/**
* The entity display repository.
*
* @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface
*/
protected $entityDisplayRepository;
/**
* Constructs a new OrderFieldsPaneDeriver object.
*
* @param string $base_plugin_id
* The base plugin ID.
* @param \Drupal\Core\Entity\EntityDisplayRepositoryInterface $entity_display_repository
* The entity display repository.
*/
public function __construct($base_plugin_id, EntityDisplayRepositoryInterface $entity_display_repository) {
$this->basePluginId = $base_plugin_id;
$this->entityDisplayRepository = $entity_display_repository;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($base_plugin_id, $container
->get('entity_display.repository'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$form_modes = $this->entityDisplayRepository
->getFormModes('commerce_order');
// Do not generate a derivative for default.
unset($form_modes['default']);
foreach ($form_modes as $form_mode_id => $form_mode_info) {
$this->derivatives[$form_mode_id] = [
'label' => sprintf('Order fields: %s', $form_mode_info['label']),
] + $base_plugin_definition;
}
return $this->derivatives;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
OrderFieldsPaneDeriver:: |
protected | property | The base plugin ID this derivative is for. | |
OrderFieldsPaneDeriver:: |
protected | property | The entity display repository. | |
OrderFieldsPaneDeriver:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
OrderFieldsPaneDeriver:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
OrderFieldsPaneDeriver:: |
public | function | Constructs a new OrderFieldsPaneDeriver object. |