function uc_ajax_cart_alter_cart_form in Ubercart AJAX Cart 7.2
Same name and namespace in other branches
- 6.2 uc_ajax_cart.module \uc_ajax_cart_alter_cart_form()
@todo Please document this function.
See also
1 call to uc_ajax_cart_alter_cart_form()
- uc_ajax_cart_form_alter in ./
uc_ajax_cart.module - @todo Please document this function.
File
- ./
uc_ajax_cart.module, line 468
Code
function uc_ajax_cart_alter_cart_form(&$form, $formState, $formId) {
if (preg_match('/^uc_catalog_buy_it_now_form_/', $formId)) {
$ucAjaxCart = new UcAjaxCart();
$product = node_load($form['nid']['#value']);
if ($product->type == 'product_kit') {
//@todo: Must be implemented
}
else {
if ($ucAjaxCart
->hasAttributes($product)) {
$form['actions']['submit']['#value'] = t('Please choose an option');
return;
}
}
}
if (!isset($form['#attributes']) || !is_array($form['#attributes'])) {
$form['#attributes'] = array();
}
$form['product-nid'] = array(
'#type' => 'hidden',
'#value' => $form['nid']['#value'],
);
if (!isset($form['#attributes']['class'])) {
$form['#attributes']['class'] = array();
}
$form['#attributes']['class'][] = 'ajax-cart-submit-form';
if (!isset($form['actions']['submit']['#attributes']['class'])) {
$form['actions']['submit']['#attributes']['class'] = array();
}
$form['actions']['submit']['#attributes']['class'][] = 'ajax-cart-submit-form-button';
}