Menu_Product implements Component
Handles the display of an individual product in a restaurant menu.
Tags
Interfaces, Classes and Traits
- Component
- Represents a restaurant menu component that can be rendered.
Table of Contents
- $options : Menu_Options
- $product : WC_Product
- $image_url : string
- $template_loader : Template_Loader
- __construct() : mixed
- get_description() : mixed
- get_image() : mixed
- get_image_url() : mixed
- get_name() : mixed
- get_order_type() : string
- Determines the available order type for a product based on the order type for this Menu_Section.
- get_price() : mixed
- get_product() : mixed
- render() : string
- Renders the component. HTML is returned, not echoed.
- get_image_size() : mixed
- get_template_args() : mixed
Properties
$options
public
Menu_Options
$options
The restaurant menu options.
$product
public
WC_Product
$product
The product for this menu item.
$image_url
private
string
$image_url
= null
The URL of the product image used in the menu (set on demand).
$template_loader
private
Template_Loader
$template_loader
The template loader.
Methods
__construct()
public
__construct(WC_Product $product, Menu_Options $options) : mixed
Parameters
- $product : WC_Product
- $options : Menu_Options
Return values
mixed —get_description()
public
get_description() : mixed
Return values
mixed —get_image()
public
get_image() : mixed
Return values
mixed —get_image_url()
public
get_image_url() : mixed
Return values
mixed —get_name()
public
get_name() : mixed
Return values
mixed —get_order_type()
Determines the available order type for a product based on the order type for this Menu_Section.
public
get_order_type() : string
If the order type is 'quick', we check if the product supports that or whether we need to force the modal. Products which always require a modal include variable products.
Return values
string —The supported order type (quick, check or modal)
get_price()
public
get_price() : mixed
Return values
mixed —get_product()
public
get_product() : mixed
Return values
mixed —render()
Renders the component. HTML is returned, not echoed.
public
render() : string
Return values
string —The component output.
get_image_size()
protected
get_image_size() : mixed
Return values
mixed —get_template_args()
protected
get_template_args(WC_Product $product) : mixed
Parameters
- $product : WC_Product