function recipe_views_data in Recipe 7.2
Same name and namespace in other branches
- 6 recipe.views.inc \recipe_views_data()
- 7 includes/recipe.views.inc \recipe_views_data()
Implements hook_views_data().
File
- includes/
recipe.views.inc, line 40 - recipe.views.inc - Views2 support for Recipe.
Code
function recipe_views_data() {
/*
* Recipe table section.
*/
// Group
$data['recipe']['table']['group'] = t('Recipe');
/* Base
* It doesn't really make sense to include the recipe table by itself. It doesn't even include the recipe title.
* Since we include the recipe table joined to node you get all of the recipe fields anyway.
*/
// Joins
$data['recipe']['table']['join']['node'] = array(
'left_field' => 'nid',
'field' => 'nid',
);
// Fields
$data['recipe']['yield'] = array(
'title' => t('Yield'),
'help' => t("The number of servings for this recipe."),
'field' => array(
'handler' => 'views_handler_field',
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['recipe']['yield_unit'] = array(
'title' => t('Yield unit'),
'help' => t("The yield unit for this recipe."),
'field' => array(
'handler' => 'views_handler_field',
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
/*
* Ingredient table section.
*/
// Group
$data['recipe_ingredient']['table']['group'] = t('Recipe');
// Fields
$data['recipe_ingredient']['id'] = array(
'title' => t('Ingredient ID'),
'help' => t("An ingredient id."),
'field' => array(
'handler' => 'views_handler_field',
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['recipe_ingredient']['name'] = array(
'title' => t('Ingredient Name'),
'help' => t("An ingredient name."),
'field' => array(
'handler' => 'views_handler_field',
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
return $data;
}