You are here

function recipe_import_element_start in Recipe 7

Same name and namespace in other branches
  1. 6 plugins/recipe_recipeML.module \recipe_import_element_start()
  2. 7.2 modules/recipe_recipeML.module \recipe_import_element_start()

Call-back function used by the XML parser.

1 string reference to 'recipe_import_element_start'
recipe_recipeML_import_form_submit in includes/recipe_recipeML.module

File

includes/recipe_recipeML.module, line 272
recipe_recipeML.module - Enables importing and exporting of recipeML format recipes.

Code

function recipe_import_element_start($parser, $name, $attributes) {
  global $recipe;
  switch ($name) {
    case 'RECIPE':
      $recipe = array(
        'title' => '',
        'description' => '',
        'yield' => '1',
        'yield_unit' => 'Servings',
        'cooktime' => 0,
        'categories' => array(),
        'ingredients' => array(),
        'instructions' => '',
        'notes' => '',
        'source' => '',
        '__region' => '',
      );
      break;
    case 'INGREDIENTS':
      $recipe['__region'] = 'ingredients';
      break;
    case 'ING':
      $ingredient = array(
        'ingredient_name' => '',
        'ingredient_note' => '',
        'quantity' => '',
        'unit_name' => '',
        'unit_key' => FALSE,
        'ingredient_note' => '',
      );
      $recipe['ingredients'][] = $ingredient;
      $recipe['__region'] = 'ING';
      break;
    case 'YIELD':
      $recipe['__region'] = 'YIELD';
      break;
    case 'PREPTIME':
      $recipe['__region'] = 'PREPTIME';
      break;
  }
}