You are here

function uc_dropdown_attributes_product in Dropdown Attributes 7

Same name and namespace in other branches
  1. 6 dependent_dropdown.inc \uc_dropdown_attributes_product()

Form constructor for the uc_dropdown_attributes_product form.

Administrative form for specifying the product attribute dependencies.

Parameters

object $product: The product with the attribute dependencies.

See also

uc_dropdown_attributes_product_submit()

uc_dropdown_attributes_dependent_callback()

theme_uc_dropdown_attributes_product()

1 string reference to 'uc_dropdown_attributes_product'
uc_dropdown_attributes_menu in ./uc_dropdown_attributes.module
Implements hook_menu().

File

./dependent_dropdown.inc, line 24
Administrative interface for specifying the attribute dependencies.

Code

function uc_dropdown_attributes_product($form, &$form_state, $product) {
  $nid = $product->nid;
  $attributes = uc_product_get_attributes($nid);
  $query = 'SELECT aid, parent_aid, parent_values, required
    FROM {uc_dropdown_attributes} WHERE nid=:nid';
  $dependencies = db_query($query, array(
    ':nid' => $nid,
  ));
  _uc_dropdown_attributes_form($form, $form_state, $attributes, $dependencies);

  // Check for overriding product class dropdowns.
  $type = uc_dropdown_attributes_dependency_type($nid);
  if (!is_null($type) && $type == 'class') {
    $form['submit']['#value'] = t('Override product class');
  }
  return $form;
}