Skip to main content
added 187 characters in body
Source Link
htoip
  • 433
  • 2
  • 19

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

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.).

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')); ?> 
Changed title
Link
htoip
  • 433
  • 2
  • 19

How can I how to insert a search form in custom content?

Source Link
htoip
  • 433
  • 2
  • 19

How can I insert a search form in custom content?

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.).