function _commerce_discount_name_exists in Commerce Discount 7
Checks if a Discount machine name is taken.
Parameters
string $value: The machine name, not prefixed with 'discount_'.
Return value
object|bool Whether or not the field machine name is taken.
1 string reference to '_commerce_discount_name_exists'
- commerce_discount_form in includes/
commerce_discount.admin.inc - Form callback: create or edit a discount.
File
- includes/
commerce_discount.admin.inc, line 416 - Commerce discount editing UI.
Code
function _commerce_discount_name_exists($value) {
// Prefix with 'discount_'.
$name = 'discount_' . $value;
return entity_load_single('commerce_discount', $name);
}