You are here

function uc_dropdown_attributes_ajax_callback in Dropdown Attributes 8

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

Ajax callback for attribute selection form elements.

1 string reference to 'uc_dropdown_attributes_ajax_callback'
uc_dropdown_attributes_product_alter in ./uc_dropdown_attributes.module
Alter products in preparation for drop down attributes.

File

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

Code

function uc_dropdown_attributes_ajax_callback($form, $form_state) {
  $trigger = $form_state
    ->getTriggeringElement();
  if ($form['node']['#value']
    ->getType() == 'product_kit') {
    $key = $trigger['#parents'][1];
    return $form['products'][$key]['attributes'];
  }
  return $form['attributes'];
}