You are here

public function PriceListItemForm::form in Commerce Pricelist 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/PriceListItemForm.php, line 18

Class

PriceListItemForm

Namespace

Drupal\commerce_pricelist\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);

  // The default edit title is wrong because EntityController::doGetEntity()
  // takes the price list entity instead of the price list item entity.
  if ($this->operation == 'edit') {
    $form['#title'] = $this
      ->t('Edit %label', [
      '%label' => $this->entity
        ->label(),
    ]);
  }
  return $form;
}