I'm trying to insert a search form in the middle of some custom HTML on a Panel Page. There's already the Search Block on the page somewhere else. The Search Widget is available, but it gets inserted after the custom HTML, which is not what I want. I thought I could do something like

<div class="container-inline">
<?php if (empty($variables['form']['#block']->subject)): ?>
<h2 class="element-invisible"><?php print t('Search form'); ?></h2>
<?php endif; ?>
<?php print $search_form; ?>



but the PHP doesn't seem to execute (naturally, I have PHP selected as the input.).

Edit: This produced a search form in the correct place, but the CSS conflicts with the existing Search Block.

<?php print render(drupal_get_form('search_block_form')); ?> 

I was close but needed to declare the variable. I still don't really understand what's happening here, but it works.

<?php global $search_form; print render(drupal_get_form('search_form')); ?>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.