You are here

public function OrderFieldsPaneDeriver::getDerivativeDefinitions in Commerce Checkout Order Fields 8

Gets the definition of all derivatives of a base plugin.

Parameters

array $base_plugin_definition: The definition array of the base plugin.

Return value

array An array of full derivative definitions keyed on derivative id.

Overrides DeriverBase::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

src/Plugin/Derivative/OrderFieldsPaneDeriver.php, line 53

Class

OrderFieldsPaneDeriver

Namespace

Drupal\commerce_checkout_order_fields\Plugin\Derivative

Code

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;
}