You are here

function uc_dropdown_attributes_order_ajax_callback in Dropdown Attributes 8

Same name and namespace in other branches
  1. 7 uc_dropdown_attributes.module \uc_dropdown_attributes_order_ajax_callback()

Ajax callback for order attribute selection form elements.

1 string reference to 'uc_dropdown_attributes_order_ajax_callback'
uc_dropdown_attributes_order_product_alter in ./uc_dropdown_attributes.module
Alter products on oder page in preparation for drop down attributes.

File

./uc_dropdown_attributes.module, line 924
A module for uc_dropdown_attributes.

Code

function uc_dropdown_attributes_order_ajax_callback($form, $form_state) {
  $trigger = $form_state
    ->getTriggeringElement();
  if (in_array('sub_products', $trigger['#parents'])) {

    // This is a product kit.
    $nid = $trigger['#parents'][2];
    return $form['products']['product_controls']['sub_products'][$nid]['attributes'];
  }
  return $form['products']['product_controls']['attributes'];
}