public function InvoiceForm::form in Commerce Invoice 8.2
Gets the actual form array to be built.
Overrides ContentEntityForm::form
See also
\Drupal\Core\Entity\EntityForm::processForm()
\Drupal\Core\Entity\EntityForm::afterBuild()
File
- src/
Form/ InvoiceForm.php, line 58
Class
- InvoiceForm
- Form controller for the commerce_invoice entity edit forms.
Namespace
Drupal\commerce_invoice\FormCode
public function form(array $form, FormStateInterface $form_state) {
/** @var \Drupal\commerce_invoice\Entity\InvoiceInterface $invoice */
$invoice = $this->entity;
$form = parent::form($form, $form_state);
$invoice_type = $this->entityTypeManager
->getStorage('commerce_invoice_type')
->load($invoice
->bundle());
$form['#title'] = $this
->t('Add new @invoice_type_label', [
'@invoice_type_label' => $invoice_type
->label(),
]);
return $form;
}