You are here

function uc_attribute_option_delete in Ubercart 8.4

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

Deletes an attribute option from the database.

Parameters

int $oid: Option ID to delete.

Return value

int The Drupal SAVED_DELETED flag.

File

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

Code

function uc_attribute_option_delete($oid) {

  // Delete the class attribute options.
  uc_attribute_subject_option_delete($oid, 'class');

  // Delete the product attribute options (and the adjustments!).
  uc_attribute_subject_option_delete($oid, 'product');

  // Delete base attributes and their options.
  $connection = \Drupal::database();
  $connection
    ->delete('uc_attribute_options')
    ->condition('oid', $oid)
    ->execute();
  return SAVED_DELETED;
}