add option to elide where no booking options to make

master
Marek Isalski 6 years ago
parent 3d9846385c
commit 91a59d5f36

@ -8,6 +8,7 @@ function fulcrm_shoppingcart_admin_form_submit( $form, &$form_state ) {
variable_set( 'fulcrm_shoppingcart_failure_url', $form_state[ 'values' ][ 'failure_url' ] );
variable_set( 'fulcrm_shoppingcart_experience', $form_state[ 'values' ][ 'experience' ] );
variable_set( 'fulcrm_shoppingcart_event_itinerary', $form_state[ 'values' ][ 'event_itinerary' ] );
variable_set( 'fulcrm_shoppingcart_donations', $form_state[ 'values' ][ 'donation_enabled' ] );
variable_set( 'fulcrm_shoppingcart_donation_cart_product', intval( $form_state[ 'values' ][ 'donation_cart_product' ] ) );
@ -44,6 +45,14 @@ function fulcrm_shoppingcart_admin_form( $form, &$form_state ) {
'#default_value' => variable_get( 'fulcrm_shoppingcart_experience', 'force' ),
);
$form[ 'event_itinerary' ] = array( '#type' => 'select',
'#title' => t('Event Itinerary'),
'#options' => array( 'elide' => t('Elide when no choices to make'),
'full' => t('Show in full'),
),
'#default_value' => variable_get( 'fulcrm_shoppingcart_event_itinerary', 'full' ),
);
$form[ 'fulcrm_url' ] = array( '#type' => 'fieldset',
'#title' => 'Return URLs',
);

@ -718,8 +718,16 @@ function fulcrm_shoppingcart_buy_eventbookingtype_form( $form, &$form_state, $pe
}
}
$form[ 'eventslots' ][ '#title' ] = 'Itinerary';
$form[ 'eventslots' ][ '#type' ] = 'fieldset';
if ( !$choices && ( variable_get( 'fulcrm_shoppingcart_event_itinerary', 'full' ) === 'elide' ) ) {
$form[ 'eventslots' ][ '#type' ] = 'container';
foreach ( $form[ 'eventslots' ] as $eventpart_id => $eventpart_form ) {
$form[ 'eventslots' ][ $eventpart_id ][ '#value' ] = $form[ 'eventslots' ][ $eventpart_id ][ '#default_value' ];
$form[ 'eventslots' ][ $eventpart_id ][ '#type' ] = 'hidden';
}
} else {
$form[ 'eventslots' ][ '#title' ] = 'Itinerary';
$form[ 'eventslots' ][ '#type' ] = 'fieldset';
}
_fulcrm_shoppingcart_buy_donation_product_update_form( $form, $form_state, variable_get( 'fulcrm_shoppingcart_donation_cart_product', 0 ) );

Loading…
Cancel
Save