public function EckContentController::add in Entity Construction Kit (ECK) 8
Provides the entity submission form.
Parameters
\Drupal\eck\EckEntityTypeInterface $eck_entity_type: The entity type.
string $eck_entity_bundle: The entity type bundle.
Return value
array The entity submission form.
1 string reference to 'EckContentController::add'
File
- src/
Controller/ EckContentController.php, line 89
Class
- EckContentController
- Provides a content controller for entities.
Namespace
Drupal\eck\ControllerCode
public function add(EckEntityTypeInterface $eck_entity_type, $eck_entity_bundle) {
$bundleStorage = $this
->getBundleStorage($eck_entity_type);
if (!$bundleStorage
->load($eck_entity_bundle)) {
throw new NotFoundHttpException($this
->t('Bundle %bundle does not exist', [
'%bundle' => $eck_entity_bundle,
]));
}
$entityStorage = $this
->entityTypeManager()
->getStorage($eck_entity_type
->id());
$entity = $entityStorage
->create([
'type' => $eck_entity_bundle,
]);
return $this
->entityFormBuilder()
->getForm($entity);
}