You are here

function recipe_get_latest in Recipe 7.2

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

Selects the latest recipes by created date.

Return value

A database query result suitable for use the node_title_list.

1 call to recipe_get_latest()
theme_recipe_landing_page in ./recipe.landing.page.inc
Returns HTML for the recipe landing page.

File

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

Code

function recipe_get_latest($count = 5) {
  $select = db_select('node', 'n');
  $select
    ->addField('n', 'nid');
  $select
    ->addField('n', 'title');
  $select
    ->addField('n', 'sticky');
  $select
    ->addField('n', 'created');
  $select
    ->condition('n.type', 'recipe');
  $select
    ->condition('n.status', 1);
  $select
    ->orderBy('n.sticky', 'DESC');
  $select
    ->orderBy('n.created', 'DESC');
  $select
    ->range(0, $count);
  $select
    ->addTag('node_access');
  return $select
    ->execute();
}