Drupal: Reusing Search Faceted Blocks

A fragmented search module in Drupal creates a set of blocks for each new faceted search environment (current search, search by query, related, etc.).

If you were to create a faceted search environment, for example. you can configure it using the base path browse/booksand start page like browse/books/results. To display the faxed search blocks, you then set the specific visibility page options for the block as "Show only on listed pages" and the actual pages as

browse/books
browse/books/results*

Question : I would like to reuse the "managed search" block on another landing page. The landing page should display a list of available search terms ( sidebar-left) and display a view of the rest of the page.

So far, simply adding another path to the "display only on listed pages" list has no effect.

+3
source share
3 answers

Drupal veterans will probably be able to offer better, cleaner and more correct solutions, but the following works for me:

I added a new block that runs the following PHP:

$env = faceted_search_env_load ( $fs_env_id );
if (!$env->ready()) 
{
    $env->prepare();
    $env->execute();
}
faceted_search_ui_add_css();
$env->ui_state['stage'] = 'results';
print faceted_search_ui_guided_block($env);

$fs_env_id . , API, , .

+1

- , , :

<?php
   $block = module_invoke('faceted_search_ui', 'block', 'view', 'xxxxx');
   print $block['content'];
?>

xxxxx - , 1_guided. , function faceted_search_ui_block(...) . , , , , , .

, , .

+1

. , , , -

Here is what I am using right now. I don’t know if this is exactly what you are looking for, but you can visualize the edges on any page that is applicable. (assuming faces should be displayed)

For me, these are search results through submissions.

I am making a block, with all the search graphs in one block.

<div class="xfacet">
Something here
<?php
$block = module_invoke('facetapi', 'block_view', 'xxxx');
print render($block['content']);
?>
</div>
<div class="xfacet">
Something there
<?php
$block = module_invoke('facetapi', 'block_view', 'xxxx');
print render($block['content']);
?>
</div>

I just control where the block is displayed. After starting, you will see a link.

0
source

Source: https://habr.com/ru/post/1779246/


All Articles