You are here

function recipe_ingredient_match in Recipe 7

Same name and namespace in other branches
  1. 6 recipe.module \recipe_ingredient_match()
  2. 7.2 recipe.admin.inc \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

3 calls to recipe_ingredient_match()
recipe_link in ./recipe.module
Implements hook_link().
recipe_mastercook4_import_single in includes/recipe_mastercook4.module
recipe_plaintext_import in includes/recipe_plaintext.module
Parsing instance for plain text recipes

File

./recipe.module, line 1735
Contains functions for Recipe node CRUD and display.

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;
}