2

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
http://api.drupal.org/api/drupal/modules!search!search-block-form.tpl.php/7

<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; ?>
</div>

or

<?php
drupal_get_form('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')); ?> 
3

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')); ?>

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.