public function UnitController::add in Booking and Availability Management Tools for Drupal 8
Provides the unit submission form.
Parameters
\Drupal\bat_unit\UnitBundleInterface $unit_bundle: The unit bundle entity for the unit.
Return value
array A unit submission form.
1 string reference to 'UnitController::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/ UnitController.php, line 74 - Contains \Drupal\bat_unit\Controller\UnitController.
Class
- UnitController
- Returns responses for Type routes.
Namespace
Drupal\bat_unit\ControllerCode
public function add(UnitBundleInterface $unit_bundle) {
$unit = $this
->entityTypeManager()
->getStorage('bat_unit')
->create([
'type' => $unit_bundle
->id(),
]);
$form = $this
->entityFormBuilder()
->getForm($unit);
return $form;
}