public function InlineFormBase::buildInlineForm in Commerce Core 8.2
Builds the inline form.
Parameters
array $inline_form: The inline form, containing the following basic properties:
- #parents: Identifies the location of the field values in $form_state.
\Drupal\Core\Form\FormStateInterface $form_state: The form state of the complete form.
Return value
array The built inline form.
Overrides InlineFormInterface::buildInlineForm
5 calls to InlineFormBase::buildInlineForm()
- ContentEntity::buildInlineForm in src/
Plugin/ Commerce/ InlineForm/ ContentEntity.php - Builds the inline form.
- CouponRedemption::buildInlineForm in modules/
promotion/ src/ Plugin/ Commerce/ InlineForm/ CouponRedemption.php - Builds the inline form.
- CustomerProfile::buildInlineForm in modules/
order/ src/ Plugin/ Commerce/ InlineForm/ CustomerProfile.php - Builds the inline form.
- PaymentGatewayForm::buildInlineForm in modules/
payment/ src/ Plugin/ Commerce/ InlineForm/ PaymentGatewayForm.php - Builds the inline form.
- PluginConfiguration::buildInlineForm in src/
Plugin/ Commerce/ InlineForm/ PluginConfiguration.php - Builds the inline form.
5 methods override InlineFormBase::buildInlineForm()
- ContentEntity::buildInlineForm in src/
Plugin/ Commerce/ InlineForm/ ContentEntity.php - Builds the inline form.
- CouponRedemption::buildInlineForm in modules/
promotion/ src/ Plugin/ Commerce/ InlineForm/ CouponRedemption.php - Builds the inline form.
- CustomerProfile::buildInlineForm in modules/
order/ src/ Plugin/ Commerce/ InlineForm/ CustomerProfile.php - Builds the inline form.
- PaymentGatewayForm::buildInlineForm in modules/
payment/ src/ Plugin/ Commerce/ InlineForm/ PaymentGatewayForm.php - Builds the inline form.
- PluginConfiguration::buildInlineForm in src/
Plugin/ Commerce/ InlineForm/ PluginConfiguration.php - Builds the inline form.
File
- src/
Plugin/ Commerce/ InlineForm/ InlineFormBase.php, line 104
Class
- InlineFormBase
- Provides the base class for inline forms.
Namespace
Drupal\commerce\Plugin\Commerce\InlineFormCode
public function buildInlineForm(array $inline_form, FormStateInterface $form_state) {
$inline_form['#type'] = 'container';
$inline_form['#tree'] = TRUE;
// Workaround for core bug #2897377.
$inline_form['#id'] = Html::getId('edit-' . implode('-', $inline_form['#parents']));
// Automatically validate and submit inline forms.
$inline_form['#inline_form'] = $this;
$inline_form['#process'][] = [
CommerceElementTrait::class,
'attachElementSubmit',
];
$inline_form['#element_validate'][] = [
CommerceElementTrait::class,
'validateElementSubmit',
];
$inline_form['#element_validate'][] = [
get_class($this),
'runValidate',
];
$inline_form['#commerce_element_submit'][] = [
get_class($this),
'runSubmit',
];
// Allow inline forms to modify the page title.
$inline_form['#process'][] = [
get_class($this),
'updatePageTitle',
];
// Tell commerce_form_alter() to fire inline form alter hooks.
$form_state
->set('has_commerce_inline_forms', TRUE);
return $inline_form;
}