You are here

function uc_atctweaks_feature_form in UC Add to Cart Tweaks 7

Same name and namespace in other branches
  1. 6 uc_atctweaks.module \uc_atctweaks_feature_form()

Settings form for individual Add to Cart Tweaks.

1 string reference to 'uc_atctweaks_feature_form'
uc_atctweaks_uc_product_feature in ./uc_atctweaks.module
Implements hook_uc_product_feature().

File

./uc_atctweaks.module, line 168
Defines a product feature to tweak the add to cart form behavior.

Code

function uc_atctweaks_feature_form($form, &$form_state, $node, $feature) {

  // Load the Add to Cart Tweaks specific to this product.
  if (!empty($feature)) {
    $atctweaks_feature = db_query('SELECT * FROM {uc_atctweaks_products} WHERE pfid = :pfid', array(
      ':pfid' => $feature['pfid'],
    ))
      ->fetchObject();
  }
  else {
    $atctweaks_feature = new stdClass();
    $atctweaks_feature->pfid = '';
    $atctweaks_feature->cart_empty = FALSE;
    $atctweaks_feature->redirect = 'global';
  }
  $form['nid'] = array(
    '#type' => 'value',
    '#value' => $node->nid,
  );
  $form['pfid'] = array(
    '#type' => 'value',
    '#value' => $atctweaks_feature->pfid,
  );
  $form += _uc_atctweaks_feature_form($atctweaks_feature);
  return $form;
}