From 3b476d386842f3b59cb431b99e23c062515cdcd2 Mon Sep 17 00:00:00 2001 From: Marek Isalski Date: Sun, 2 Sep 2018 16:47:11 +0100 Subject: [PATCH] fixup auto-check single options --- fulcrm_shoppingcart.module | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fulcrm_shoppingcart.module b/fulcrm_shoppingcart.module index de4f7ca..61d34b7 100644 --- a/fulcrm_shoppingcart.module +++ b/fulcrm_shoppingcart.module @@ -582,6 +582,7 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form( $form, &$form_state, $pe $form[ 'eventslots' ][ $eventpart_key ] = array( '#type' => 'radios', '#title' => $eventparts[ $eventpart_id ][ 'name' ], '#options' => array(), + '#required' => TRUE, ); $eventslot_id = fulcrm_crypto_object_id_form_value( 'eventslot.id', $eventslot[ 'id' ] ); $remaining_capacity = $eventslot[ '_remaining_capacity' ]; @@ -590,10 +591,10 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form( $form, &$form_state, $pe } $choices = false; - foreach ( $form[ 'eventslots' ] as $eventpart_id => $eventpart ) { - if ( count( $eventpart[ '#options' ] ) == 1 ) { - foreach ( $eventpart[ '#options' ] as $option_key => $option_value ) - $eventpart[ '#default_value' ] = $option_key; + foreach ( $form[ 'eventslots' ] as $eventpart_id => $eventpart_form ) { + if ( count( $eventpart_form[ '#options' ] ) == 1 ) { + foreach ( $eventpart_form[ '#options' ] as $option_key => $option_value ) + $form[ 'eventslots' ][ $eventpart_id ][ '#default_value' ] = $option_key; } else { $choices = true; }