I'm not a programmer, but I'm often able to copy simple exemple. With the help of Google and the Drupal web site, I've found some exemples that enabled me to put togheter this bit of code to print the Biblio search form in a block or page:

<?php
module_load_include('inc', 'biblio', 'includes/biblio.pages');
$form = drupal_get_form('biblio_search_form', TRUE);
print render($form);
 ?>

My question: What could be inserted in this to have the form uncollapse by default?

Thank you,

Denis

Comments

p0732658’s picture

I really don't know what I'm doing, but I thing I'm getting close to answer my own question:

<?php
module_load_include('inc', 'biblio', 'includes/biblio.pages');
$form = drupal_get_form('biblio_search_form', TRUE);
$form['search_form'] = array(
        '#type'   => 'fieldset',
        '#title'   => t('Search'),
        '#collapsible' => FALSE,
        '#collapsed' => FALSE,
        'searchform' => $searchform,
        'filterform' => biblio_form_filter(),
      );
print render($form);
 ?>

The output is ugly (like a box in a box), but at least the search form is open and not collapsed. I'm sure there must be an easier way for this...

Thank you,

Denis

rjerome’s picture

This should eliminate the outer most box...

module_load_include('inc', 'biblio', 'includes/biblio.pages');
$searchform= drupal_get_form('biblio_search_form', TRUE);
$form['search_form'] = array(
         'searchform' => $searchform,
        'filterform' => biblio_form_filter(),
      );
print render($form);
p0732658’s picture

Thank very much!

I've also find another option, but this option would require different theme for different section.

With the help of hook_form_alter in template.php, I wrote this:

<?php
function mybartik_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'biblio_search_form') {
    $form['search_form']['#title'] = t('Search');
    $form['search_form']['#collapsible'] = FALSE;  //Search form
    $form['search_form']['#collapsed'] = FALSE;  //Search form
///dpm($form);
    $form['search_form']['filterform']['filters']['#title'] = t('Limit to');
    $form['search_form']['filterform']['filters']['#collapsible'] = FALSE;  //Filter form fields
    $form['search_form']['filterform']['filters']['#collapsed'] = FALSE;  //Filter form fields
    $form['search_form']['searchform']['biblio_search']['submit']['#value'] = t('Find');
    $form['search_form']['filterform']['filters']['status']['filters']['type']['#access'] = FALSE;  //Hide type filter
	$form['search_form']['filterform']['filters']['status']['filters']['year']['#access'] = FALSE;  //Hide year filter
	$form['search_form']['filterform']['filters']['status']['filters']['author']['#access'] = FALSE;  //Hide author filter
    $form['search_form']['filterform']['filters']['status']['filters']['keyword']['#access'] = FALSE;  //Hide keyword
  }
}
?>

My idea is to have a theme for each documents types (theses, articles, books) and to write different template.php for each of them (function thesebartik_form_alter, function articlebartik_form_alter, function bookbartik_form_alter, etc.). Of course, mybartik sould be change for the use theme name.

But, I will first experiment with jerome code before I explore this option more.

Denis

liam morland’s picture

Issue summary: View changes
Status: Active » Fixed

If you need further help, please re-open and provide details.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.