You are here

public function ForwardFormBuilder::buildForm in Forward 4.0.x

Same name and namespace in other branches
  1. 4.x src/Services/ForwardFormBuilder.php \Drupal\forward\Services\ForwardFormBuilder::buildForm()

Builds a Forward form for a given entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: Entity for which the form is being built.

Return value

array A render array for the form.

Overrides ForwardFormBuilderInterface::buildForm

File

src/Services/ForwardFormBuilder.php, line 227

Class

ForwardFormBuilder
Defines a class for building markup for a Forward inline form on an entity.

Namespace

Drupal\forward\Services

Code

public function buildForm(EntityInterface $entity) {
  $render_array = [];
  if ($entity
    ->access('view')) {
    $form = new ForwardForm($entity, $this->routeMatch, $this->moduleHandler, $this->entityTypeManager, $this->requestStack, $this->database, $this->tokenService, $this->floodInterface, $this->accountSwitcher, $this->renderer, $this->eventDispatcher, $this->mailer, $this->linkGenerator, $this->time, $this->emailValidator);
    $render_array = $this->formBuilder
      ->getForm($form);
  }
  return $render_array;
}