You are here

function uc_attribute_delete_confirm in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_attribute/uc_attribute.admin.inc \uc_attribute_delete_confirm()
  2. 7.3 uc_attribute/uc_attribute.admin.inc \uc_attribute_delete_confirm()
1 string reference to 'uc_attribute_delete_confirm'
uc_attribute_menu in uc_attribute/uc_attribute.module
Implementation of hook_menu().

File

uc_attribute/uc_attribute.module, line 516

Code

function uc_attribute_delete_confirm($aid) {
  $attribute = uc_attribute_load($aid);

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