public function ContentTypeModule::getFormObject in Opigno module 8
Same name and namespace in other branches
- 3.x src/Plugin/OpignoGroupManagerContentType/ContentTypeModule.php \Drupal\opigno_module\Plugin\OpignoGroupManagerContentType\ContentTypeModule::getFormObject()
Get the form object based on the entity ID.
If no entity given in parameter, return the entity creation form object.
Parameters
int $entity_id: The entity ID.
Return value
\Drupal\Core\Entity\EntityFormInterface Form.
Overrides ContentTypeInterface::getFormObject
File
- src/
Plugin/ OpignoGroupManagerContentType/ ContentTypeModule.php, line 240
Class
- ContentTypeModule
- Class ContentTypeModule.
Namespace
Drupal\opigno_module\Plugin\OpignoGroupManagerContentTypeCode
public function getFormObject($entity_id = NULL) {
$form = \Drupal::entityTypeManager()
->getFormObject($this
->getEntityType(), 'default');
if (empty($entity_id)) {
$entity = OpignoModule::create();
}
else {
$entity = OpignoModule::load($entity_id);
}
$form
->setEntity($entity);
return $form;
}