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_Ingredients

The class that handles the specialty ingredients funcitonality.

Final
Package: Simmer\Recipes\Items\Ingredients
Since: 1.3.0
Located at core/recipes/items/ingredients/class-simmer-recipe-ingredients.php
Methods summary
public string
# get_list_heading( )

Get the ingredients list heading text.

Get the ingredients list heading text.

Returns

string
$heading The ingredients list heading text.

Since

1.3.0
public string
# get_list_type( )

Get the ingredients list type.

Get the ingredients list type.

Returns

string
$type The ingredients list type.

Since

1.3.0
public object|boolean
# get_ingredient( integer $ingredient_id )

Get an existing ingredient.

Get an existing ingredient.

Parameters

$ingredient_id
The ingredient ID.

Returns

object|boolean
$ingredient The ingredient object on success, false on failure.

Since

1.3.0
public integer|boolean
# add_ingredient( integer $recipe_id, string $description, float $amount = null, string $unit = '', boolean $is_heading = false, integer $order = 0 )

Add a new ingredient.

Add a new ingredient.

Parameters

$recipe_id
The recipe ID.
$description
The ingredient description.
$amount
Optional. The ingredient amount.
$unit
Optional. The ingredient unit.
$is_heading
Optional. Whether the ingredient is a heading.
$order
Optional. The ingredient order number.

Returns

integer|boolean
$result The new ingredient's ID or false on failure.

Since

1.3.0
public integer|boolean
# update_ingredient( integer $ingredient_id, array $args )

Update an existing ingredient.

Update an existing ingredient.

Parameters

$ingredient_id
The ID for the ingredient to update.
$args

{ The updated ingredient values.

Returns

integer|boolean
$result The ingredient ID or false on failure.

Since

1.3.0

Type

int $recipe_id The recipe ID.
float $amount The ingredient amount.
string $unit Optional. The ingredient unit.
string $description Optional. The ingredient description.
bool $is_heading Whether the ingredient is a heading.

int $order Optional. The ingredient order number. }


public boolean
# delete_ingredient( integer $ingredient_id )

Delete an existing ingredient.

Delete an existing ingredient.

Parameters

$ingredient_id
The ID for the ingredient you want to delete.

Returns

boolean
$result Whether the ingredient was deleted.

Since

1.3.0
public static array
# get_units( )

Get the available units of measure.

Get the available units of measure.

Returns

array
$units The filtered units.

Since

1.3.0
Simmer API documentation generated by ApiGen