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