You are here

public function EckEntityForm::form in Entity Construction Kit (ECK) 8

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/Entity/EckEntityForm.php, line 18

Class

EckEntityForm
Form controller for the ECK entity forms.

Namespace

Drupal\eck\Form\Entity

Code

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

  /** @var \Drupal\eck\Entity\EckEntity $entity */
  $entity = $this->entity;
  if ($this->operation == 'edit') {
    $form['#title'] = $this
      ->t('<em>Edit @type</em> @title', [
      '@type' => $entity->type->entity
        ->label(),
      '@title' => $entity
        ->label(),
    ]);
  }
  return $form;
}