You are here

function uc_attribute_delete in Ubercart 7.3

Same name and namespace in other branches
  1. 8.4 uc_attribute/uc_attribute.module \uc_attribute_delete()
  2. 6.2 uc_attribute/uc_attribute.module \uc_attribute_delete()

Deletes an attribute from the database.

Parameters

int $aid: Attribute ID to delete.

Return value

int The Drupal SAVED_DELETED flag.

1 call to uc_attribute_delete()
UbercartAttributeTestCase::testAttributeAPI in uc_attribute/tests/uc_attribute.test
Tests the basic attribute API.

File

uc_attribute/uc_attribute.module, line 782
Ubercart Attribute module.

Code

function uc_attribute_delete($aid) {

  // Delete the class attributes and their options.
  uc_attribute_subject_delete($aid, 'class');

  // Delete the product attributes and their options.
  uc_attribute_subject_delete($aid, 'product');

  // Delete base attributes and their options.
  db_delete('uc_attribute_options')
    ->condition('aid', $aid)
    ->execute();
  db_delete('uc_attributes')
    ->condition('aid', $aid)
    ->execute();
  return SAVED_DELETED;
}