Class Simmer_Recipe_Ingredients
The class that handles the specialty ingredients funcitonality.
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.
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
|