You are here

function uc_attribute_delete_confirm in Ubercart 7.3

Same name and namespace in other branches
  1. 5 uc_attribute/uc_attribute.module \uc_attribute_delete_confirm()
  2. 6.2 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 167
Attribute administration menu items.

Code

function uc_attribute_delete_confirm($form, &$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/products/attributes');
  }
  $form['aid'] = array(
    '#type' => 'value',
    '#value' => $attribute->aid,
  );
  $count = db_query("SELECT COUNT(*) FROM {uc_product_attributes} WHERE aid = :aid", array(
    ':aid' => $attribute->aid,
  ))
    ->fetchField();
  $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 1 product with this attribute.', 'There are @count products with this attribute.'), t('Delete'), t('Cancel'));
  return $output;
}