You are here

function theme_recipe_landing_page in Recipe 7.2

Same name and namespace in other branches
  1. 6 recipe.landing.page.inc \theme_recipe_landing_page()
  2. 7 recipe.landing.page.inc \theme_recipe_landing_page()

Returns HTML for the recipe landing page.

1 theme call to theme_recipe_landing_page()
recipe_landing_page in ./recipe.landing.page.inc
Page callback: Displays the Recipes Menu and list of recent recipes.

File

./recipe.landing.page.inc, line 18
Page callbacks for recipe index page.

Code

function theme_recipe_landing_page() {
  drupal_set_title(t("Recipes Menu"));

  // Add the recipe.css file for this page.
  drupal_add_css(drupal_get_path('module', 'recipe') . '/recipe.css');

  // Get a list of current sub-menus and render them as a list.
  $item = menu_get_item();
  $content = system_admin_menu_block($item);
  if (user_access('create recipe content')) {
    $content[] = array(
      'title' => t('Add a new recipe'),
      'description' => '',
      'href' => 'node/add/recipe',
      'localized_options' => array(
        'attributes' => array(),
      ),
    );
  }
  $output = '<div class="recipe_index_list">';
  $output .= theme('node_add_list', array(
    'content' => $content,
  ));
  $output .= '</div>';

  // Render the recent recipes list.
  if (variable_get('recipe_recent_box_enable', 1) == 1) {
    $node_list = recipe_get_latest(variable_get('recipe_recent_display', 5));
    $build_node_list = node_title_list($node_list);
    $output .= '<div class="recipe_index_recent">';
    $output .= '<h2 class="title">' . variable_get('recipe_recent_box_title', t('Latest recipes')) . '</h2><div>' . drupal_render($build_node_list) . '</div>';
    $output .= '</div>';
  }
  return $output;
}