You are here

function uc_attribute_delete_confirm in Ubercart 6.2

Same name and namespace in other branches
  1. 5 uc_attribute/uc_attribute.module \uc_attribute_delete_confirm()
  2. 7.3 uc_attribute/uc_attribute.admin.inc \uc_attribute_delete_confirm()

Confirms the deletion of the given attribute.

See also

uc_attribute_delete_confirm_submit()

1 string reference to 'uc_attribute_delete_confirm'
uc_attribute_menu in uc_attribute/uc_attribute.module
Implements hook_menu().

File

uc_attribute/uc_attribute.admin.inc, line 156
Attribute administration menu items.

Code

function uc_attribute_delete_confirm($form_state, $attribute) {

  // If we got a bunk attribute, kick out an error message.
  if (empty($attribute)) {
    drupal_set_message(t('There is no attribute with that ID.'), 'error');
    drupal_goto('admin/store/attributes');
  }
  $form['aid'] = array(
    '#type' => 'value',
    '#value' => $attribute->aid,
  );
  $form['#redirect'] = 'admin/store/attributes';
  $count = db_result(db_query("SELECT COUNT(*) FROM {uc_product_attributes} WHERE aid = %d", $attribute->aid));
  $output = confirm_form($form, t('Are you sure you want to delete the attribute %name?', array(
    '%name' => $attribute->name,
  )), 'admin/store/attributes', format_plural($count, 'There is @count product with this attribute.', 'There are @count products with this attribute.'), t('Delete'), t('Cancel'));
  return $output;
}