You are here

function recipe_ingredient_match in Recipe 7.2

Same name and namespace in other branches
  1. 6 recipe.module \recipe_ingredient_match()
  2. 7 recipe.module \recipe_ingredient_match()

Returns the ID and name of an existing ingredient.

Parameters

string $recipe_ingredient_name: A recipe_ingredient_name.

Return value

array A recipe_ingredient array upon successful load or FALSE

2 calls to recipe_ingredient_match()
recipe_mastercook4_import_single in modules/recipe_mastercook4.module
recipe_plaintext_import in modules/recipe_plaintext.module
Parsing instance for plain text recipes

File

./recipe.admin.inc, line 434
Contains admin page callbacks, form validation, and form submission handlers.

Code

function recipe_ingredient_match($recipe_ingredient_name) {
  $result = db_query("SELECT id, name FROM {recipe_ingredient} where name = :name", array(
    ':name' => $recipe_ingredient_name,
  ));
  foreach ($result as $row) {
    return array(
      'id' => $row->id,
      'name' => $row->name,
    );
  }
  return FALSE;
}