function uc_product_is_product in Ubercart 5
Same name and namespace in other branches
- 8.4 uc_product/uc_product.module \uc_product_is_product()
- 6.2 uc_product/uc_product.module \uc_product_is_product()
- 7.3 uc_product/uc_product.module \uc_product_is_product()
Determing if the given node is a product.
Parameters
$node If an object or array, it's "type" member is considered. If a: a string, it's value is considered. If an integer, node_load() is called.
Return value
boolean
3 calls to uc_product_is_product()
- uc_attribute_product_access in uc_attribute/
uc_attribute.module - uc_attribute_product_option_access in uc_attribute/
uc_attribute.module - uc_product_token_values in uc_product/
uc_product.module - Provide product token values.
File
- uc_product/
uc_product.module, line 2273 - The product module for Ubercart.
Code
function uc_product_is_product($node) {
if (is_int($node)) {
$node = node_load($node);
}
if (is_object($node)) {
$type = $node->type;
}
elseif (is_array($node)) {
$type = $node['type'];
}
elseif (is_string($node)) {
$type = $node;
}
if (!$type) {
return false;
}
$types = module_invoke_all('product_types');
return in_array($type, $types);
}