You are here

function ingredient_quantity_from_fraction in Recipe 8.2

Converts an ingredient's quantity from fraction to decimal.

Parameters

string $ingredient_quantity: The ingredient quantity formatted as a fraction.

Return value

float The ingredient quantity formatted as a decimal.

Deprecated

This function was deprecated in version 8.x-2.0 and will be removed in version 3.0.0. Use \Drupal\ingredient\Utility\IngredientQuantityUtility::getQuantityFromFraction() instead.

File

modules/ingredient/ingredient.module, line 119
Contains basic functions for the Ingredient module.

Code

function ingredient_quantity_from_fraction($ingredient_quantity) {
  return \Drupal::service('ingredient.quantity')
    ->getQuantityFromFraction($ingredient_quantity);
}