You are here

public function TypeController::add in Booking and Availability Management Tools for Drupal 8

Provides the unit type submission form.

Parameters

\Drupal\bat_unit\TypeBundleInterface $type_bundle: The type bundle entity for the unit type.

Return value

array A unit type submission form.

1 string reference to 'TypeController::add'
bat_unit.routing.yml in modules/bat_unit/bat_unit.routing.yml
modules/bat_unit/bat_unit.routing.yml

File

modules/bat_unit/src/Controller/TypeController.php, line 73
Contains \Drupal\bat_unit\Controller\TypeController.

Class

TypeController
Returns responses for Type routes.

Namespace

Drupal\bat_unit\Controller

Code

public function add(TypeBundleInterface $type_bundle) {
  $type = $this
    ->entityTypeManager()
    ->getStorage('bat_unit_type')
    ->create([
    'type' => $type_bundle
      ->id(),
  ]);
  $form = $this
    ->entityFormBuilder()
    ->getForm($type);
  return $form;
}