function uc_attribute_options_form in Ubercart 7.3
Same name and namespace in other branches
- 6.2 uc_attribute/uc_attribute.admin.inc \uc_attribute_options_form()
Displays options and the modifications to products they represent.
See also
uc_attribute_options_form_validate()
uc_attribute_options_form_submit()
1 string reference to 'uc_attribute_options_form'
- uc_attribute_menu in uc_attribute/
uc_attribute.module - Implements hook_menu().
File
- uc_attribute/
uc_attribute.admin.inc, line 241 - Attribute administration menu items.
Code
function uc_attribute_options_form($form, &$form_state, $attribute) {
// Set an appropriate title.
drupal_set_title(t('Options for %name', array(
'%name' => $attribute->name,
)), PASS_THROUGH);
// Store the attribute ID in the form array.
$form['aid'] = array(
'#type' => 'value',
'#value' => $attribute->aid,
);
$form['options'] = array();
// Loop through all the options on an attribute.
foreach ($attribute->options as $key => $data) {
$form['options'][$key] = array(
'name' => array(
'#markup' => check_plain($data->name),
),
'cost' => array(
'#theme' => 'uc_price',
'#price' => $data->cost,
),
'price' => array(
'#theme' => 'uc_price',
'#price' => $data->price,
),
'weight' => array(
'#markup' => (string) $data->weight,
),
'ordering' => array(
'#type' => 'weight',
'#delta' => 50,
'#default_value' => $data->ordering,
'#attributes' => array(
'class' => array(
'uc-attribute-option-table-ordering',
),
),
),
'edit' => array(
'#markup' => l(t('edit'), 'admin/store/products/attributes/' . $attribute->aid . '/options/' . $key . '/edit'),
),
'delete' => array(
'#markup' => l(t('delete'), 'admin/store/products/attributes/' . $attribute->aid . '/options/' . $key . '/delete'),
),
);
}
if (count($form['options'])) {
$form['options']['#tree'] = TRUE;
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save changes'),
'#weight' => 10,
);
}
return $form;
}