Skip to content
Snippets Groups Projects
Commit d9dd80a7 authored by Owen Bush's avatar Owen Bush
Browse files

Fix issue with editing an old registrant and form fields being hidden

parent 6e78c3a4
No related branches found
No related tags found
No related merge requests found
...@@ -301,6 +301,10 @@ class RegistrantForm extends ContentEntityForm { ...@@ -301,6 +301,10 @@ class RegistrantForm extends ContentEntityForm {
* The form state interface. * The form state interface.
*/ */
protected function hideFormFields(array &$form, FormStateInterface $form_state) { protected function hideFormFields(array &$form, FormStateInterface $form_state) {
/* @var $entity \Drupal\recurring_events_registration\Entity\Registrant */
$entity = $this->entity;
$new = $entity->isNew();
$form_fields = $this->fieldManager->getFieldDefinitions('registrant', $this->entity->getBundle()); $form_fields = $this->fieldManager->getFieldDefinitions('registrant', $this->entity->getBundle());
$availability = $this->creationService->retrieveAvailability(); $availability = $this->creationService->retrieveAvailability();
...@@ -311,7 +315,7 @@ class RegistrantForm extends ContentEntityForm { ...@@ -311,7 +315,7 @@ class RegistrantForm extends ContentEntityForm {
// no spaces left, and no waitlist. // no spaces left, and no waitlist.
if (($availability === 0 && !$waitlist) || !$registration_open) { if (($availability === 0 && !$waitlist) || !$registration_open) {
foreach ($form_fields as $field_name => $field) { foreach ($form_fields as $field_name => $field) {
if (isset($form[$field_name])) { if (isset($form[$field_name]) && $new) {
$form[$field_name]['#printed'] = TRUE; $form[$field_name]['#printed'] = TRUE;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment