You are here

public function CheckoutFlowWithPanesBase::getPanes in Commerce Core 8.2

Gets the panes.

Return value

\Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CheckoutPaneInterface[] The panes, keyed by pane id, ordered by weight.

Overrides CheckoutFlowWithPanesInterface::getPanes

4 calls to CheckoutFlowWithPanesBase::getPanes()
CheckoutFlowWithPanesBase::buildConfigurationForm in modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowWithPanesBase.php
Form constructor.
CheckoutFlowWithPanesBase::calculateDependencies in modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowWithPanesBase.php
Calculates dependencies for the configured plugin.
CheckoutFlowWithPanesBase::getPane in modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowWithPanesBase.php
Gets a pane with the given ID.
CheckoutFlowWithPanesBase::getVisiblePanes in modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowWithPanesBase.php
Gets the visible panes for the given step ID.

File

modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowWithPanesBase.php, line 86

Class

CheckoutFlowWithPanesBase
Provides a base checkout flow that uses checkout panes.

Namespace

Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow

Code

public function getPanes() {
  if (empty($this->panes)) {
    foreach ($this->paneManager
      ->getDefinitions() as $pane_id => $pane_definition) {
      $pane_configuration = $this
        ->getPaneConfiguration($pane_id);
      $pane = $this->paneManager
        ->createInstance($pane_id, $pane_configuration, $this);
      $this->panes[$pane_id] = [
        'pane' => $pane,
        'weight' => $pane
          ->getWeight(),
      ];
    }

    // Sort the panes and flatten the array.
    uasort($this->panes, [
      SortArray::class,
      'sortByWeightElement',
    ]);
    $this->panes = array_map(function ($pane_data) {
      return $pane_data['pane'];
    }, $this->panes);
  }
  return $this->panes;
}