Overview

Packages

  • Simmer
    • Admin
      • Bulk
      • Functions
      • Recipes
      • Settings
    • Deprecated
    • Frontend
    • Install
    • Recipes
      • Items
        • Ingredients
        • Instructions
      • Shortcode
    • Upgrade
    • Widgets

Classes

  • Simmer_Recipe_Ingredient
  • Simmer_Recipe_Ingredients

Functions

  • simmer_add_recipe_ingredient
  • simmer_delete_recipe_ingredient
  • simmer_get_ingredients_list_heading
  • simmer_get_ingredients_list_type
  • simmer_get_recipe_ingredient
  • simmer_get_the_ingredients
  • simmer_list_ingredients
  • simmer_update_recipe_ingredient
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class Simmer_Recipe_Ingredient

The class for gathering and formatting information about a single recipe ingredient.

Final
Package: Simmer\Recipes\Items\Ingredients
Since: 1.3.0
Located at core/recipes/items/ingredients/class-simmer-recipe-ingredient.php
Methods summary
public
# __construct( integer|object $ingredient )

Construct the ingredient object.

Construct the ingredient object.

Parameters

$ingredient
The ingredient item or item ID.

Since

1.0.0
public string
# get_amount( boolean $raw = false )

Get the amount.

Get the amount.

Parameters

$raw
Optional. Whether to get the unaltered amount. Default: false.

Returns

string
$amount The ingredient amount.

Since

1.3.0
public string
# get_unit( boolean $raw = false )

Get the unit of measure.

Get the unit of measure.

Parameters

$raw
Optional. Whether to get the unaltered unit. Default: false.

Returns

string
$unit The ingredient unit.

Since

1.3.0
public string
# get_description( boolean $raw = false )

Get the description.

Get the description.

Parameters

$raw
Optional. Whether to get the unaltered description. Default: false.

Returns

string
$description The ingredient description.

Since

1.3.0
public string
# is_heading( boolean $raw = false )

Determine if the ingredient is a heading.

Determine if the ingredient is a heading.

Parameters

$raw
Whether to get the heading status unaltered from the database.

Returns

string
$is_heading Whether the ingredient is a heading..

Since

1.3.3
public static string|integer
# convert_amount_to_string( float $amount )

Convert an ingredient amount float to a string.

Convert an ingredient amount float to a string.

Parameters

$amount
The amount to convert.

Returns

string|integer
$amount The converted amount.

Since

1.0.0
public static float
# convert_amount_to_float( string|integer $amount )

Convert the amount string to a float.

Convert the amount string to a float.

Parameters

$amount
The amount to convert.

Returns

float
$amount The converted amount.

Since

1.0.0
public static string
# get_unit_label( array $unit, integer $count = 1 )

Get the approprate label for a given unit based on count.

Get the approprate label for a given unit based on count.

Parameters

$unit
The given unit & its labels.
$count
Optional. The ingredient count.

Returns

string
$label The appropriate label.

Since

1.0.0
Properties summary
public integer $id

The ingredient's item ID.

The ingredient's item ID.

Since

1.3.0
#
public string $amount

The ingredient amount.

The ingredient amount.

Since

1.0.0
# ''
public string $unit

The ingredient unit of measure.

The ingredient unit of measure.

Since

1.0.0
# ''
public string $description

The ingredient description.

The ingredient description.

Since

1.0.0
# ''
public integer $order

The ingredient order number.

The ingredient order number.

Since

1.3.0
# 0
Simmer API documentation generated by ApiGen