public function Review::buildPaneForm in Commerce Core 8.2
Builds the pane form.
Parameters
array $pane_form: The pane form, containing the following basic properties:
- #parents: Identifies the position of the pane form in the overall parent form, and identifies the location where the field values are placed within $form_state->getValues().
\Drupal\Core\Form\FormStateInterface $form_state: The form state of the parent form.
array $complete_form: The complete form structure.
Overrides CheckoutPaneInterface::buildPaneForm
File
- modules/
checkout/ src/ Plugin/ Commerce/ CheckoutPane/ Review.php, line 22
Class
- Review
- Provides the review pane.
Namespace
Drupal\commerce_checkout\Plugin\Commerce\CheckoutPaneCode
public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form) {
/** @var \Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CheckoutPaneInterface[] $enabled_panes */
$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()) {
// BC layer for panes which still return rendered strings.
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;
}