You are here

function search_api_page_block_view in Search API Pages 7

Implements hook_block_view().

File

./search_api_page.module, line 160
Generate search pages using Search API indexes.

Code

function search_api_page_block_view($delta) {
  $page = search_api_page_load($delta);
  if ($page && $page->enabled && search_api_page_access($delta)) {
    $block = array();
    $block['subject'] = t($page->name);
    $block['content'] = drupal_get_form('search_api_page_search_form_' . $page->machine_name, $page, NULL, TRUE);
    $block['content']['#contextual_links']['search_api_page'] = array(
      'admin/config/search/search_api/page',
      array(
        $page->machine_name,
      ),
    );
    return $block;
  }
  return NULL;
}