Review.php in Commerce Core 8.2
File
modules/checkout/src/Plugin/Commerce/CheckoutPane/Review.php
View source
<?php
namespace Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Link;
class Review extends CheckoutPaneBase implements CheckoutPaneInterface {
public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form) {
$enabled_panes = array_filter($this->checkoutFlow
->getPanes(), function ($pane) {
return !in_array($pane
->getStepId(), [
'_sidebar',
'_disabled',
]);
});
foreach ($enabled_panes as $pane_id => $pane) {
if ($summary = $pane
->buildPaneSummary()) {
if ($summary && !is_array($summary)) {
$summary = [
'#markup' => $summary,
];
}
$label = isset($summary['#title']) ? $summary['#title'] : $pane
->getDisplayLabel();
if ($pane
->isVisible()) {
$edit_link = Link::createFromRoute($this
->t('Edit'), 'commerce_checkout.form', [
'commerce_order' => $this->order
->id(),
'step' => $pane
->getStepId(),
]);
$label .= ' (' . $edit_link
->toString() . ')';
}
$pane_form[$pane_id] = [
'#type' => 'fieldset',
'#title' => $label,
];
$pane_form[$pane_id]['summary'] = $summary;
}
}
return $pane_form;
}
}