Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
LLMS_Admin_AddOns::get_products_for_cat( string $cat, $include_bundles = true )
Retrieve products for a specific category.
Parameters Parameters
- $cat
-
(string) (Required) Category slug.
Return Return
(array)
Source Source
File: includes/admin/class.llms.admin.addons.php
private function get_products_for_cat( $cat, $include_bundles = true ) {
$products = array();
foreach ( $this->data['items'] as $item ) {
$cats = array_keys( $item['categories'] );
// Exclude bundles if bundles are not being included or requested.
if ( 'bundles' !== $cat && ! $include_bundles && in_array( 'bundles', $cats, true ) ) {
continue;
}
if ( in_array( $cat, $cats, true ) ) {
$products[] = $item;
}
}
return $products;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 7.1.0 | Use strict comparisons for in_array(). |
| 3.22.0 | Introduced. |