public function ContentTypeILT::getFormObject in Opigno Instructor-led Trainings 8
Same name and namespace in other branches
- 3.x src/Plugin/OpignoGroupManagerContentType/ContentTypeILT.php \Drupal\opigno_ilt\Plugin\OpignoGroupManagerContentType\ContentTypeILT::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/ ContentTypeILT.php, line 127
Class
- ContentTypeILT
- Class ContentTypeILT.
Namespace
Drupal\opigno_ilt\Plugin\OpignoGroupManagerContentTypeCode
public function getFormObject($entity_id = NULL) {
if (empty($entity_id)) {
$form = \Drupal::entityTypeManager()
->getFormObject($this
->getEntityType(), 'add');
$entity = ILT::create();
}
else {
$form = \Drupal::entityTypeManager()
->getFormObject($this
->getEntityType(), 'edit');
$entity = ILT::load($entity_id);
}
$form
->setEntity($entity);
return $form;
}