By Sebastiaan Brozius on
I'm busy with a theme and am trying to change the name of the Search-button.
This actually works, but when I change it, search doesn't work anymore...
Here's the code of the working search-box:
<div><div id="search" class="container-inline"><div class="form-item">
<input type="text" maxlength="128" class="form-text" name="edit[keys]" id="edit-keys" size="15" value="" alt="Enter the terms you wish to search for." />
</div>
<input type="submit" class="form-submit button" name="op" value="Search" />
<input type="hidden" name="edit[form_id]" value="search_box" />
</div>
</div>
When I change the value of the button to, say, "fetch" search stops working...
<div><div id="search" class="container-inline"><div class="form-item">
<input type="text" maxlength="128" class="form-text" name="edit[keys]" id="edit-keys" size="15" value="" alt="Enter the terms you wish to search for." />
</div>
<input type="submit" class="form-submit button" name="op" value="Fetch" />
<input type="hidden" name="edit[form_id]" value="search_box" />
</div>
</div>
Can anyone tell me how to change the display-name of the search-box without breaking it's function?
Comments
here is how I did it
change it in the search module --- if you don't know how to change the code in a module post again and I'll explain it -- find this code or something like it in your version and change the word Search to the word you prefer
override in template.php?
Is this something tat can be overriden with template.php?
I hate to mess around in modules if not needed...
And, perhaps even more important, how come that when you change the value of the button to anything other than 'Search' it doesn't work anymore?
I'm using Drupal 6 and I'm
I'm using Drupal 6 and I'm trying to remove the word "search this site" does anyone know how I would do this?
With CSS
In order to remove "Search this site", I just added the following code to main CSS file of the theme:
I think it can also be changed from the php file that generates the block but right now I didn't dig it...
Hope it helps...
Sinan
can't find "function search_block"
Hello Jenny C,
i m using D7. i can't find function search_block. i get----
line no-138 to 157
/**
* Implements hook_block_info().
*/
function search_block_info() {
$blocks['form']['info'] = t('Search form');
// Not worth caching.
$blocks['form']['cache'] = DRUPAL_NO_CACHE;
$blocks['form']['properties']['administrative'] = TRUE;
return $blocks;
}
/**
* Implements hook_block_view().
*/
function search_block_view($delta = '') {
if (user_access('search content')) {
$block['content'] = drupal_get_form('search_block_form');
return $block;
}
}
-------------------------------------------------------------------------------------
so how i can modified it? plz reply me. Awaiting for your quick response.
Should work, but look at new search.module code
Such change in a template is outlined elsewhere:
http://drupal.org/node/45295
However, take a look at the RC1 version of this module, since the code for the search module seems to have changed substantially, and now uses the Drupal 4.7 forms API. The function
search_form()in search.module seems to be the one that creates the search form.Looking at the drupal.org page source as I post this, I see the following for the search box:
I assume the drupal site is running off 4.7RC1. I think the form_id value "search_theme_form" is used in form.inc, in the function
drupal_get_form(). In the comments for this function, it is implied that you can theme any form using this unique form ID, but that's as far as I've gotten. As seems to generally be the case with Drupal, some great code is far ahead of the documentation on how to use it fully.---
Work: BioRAFT
Thanks, but the id-value
Thanks, but the id-value "search_theme_form" has to do with how it is themed (CSS-referal) and is not found in form.inc. CSS cannot set a text-value, only style-values.... (as far as I know...)
Anyway, this question has nothing directly to do with theming in the sense of how it is styled, but more how the name of the button can be changed (the "value="-line of the search-box)...
This is not something that can be changed in the suggested url; I'm already using that method, and changing the vlaue of the button breaks the search-box.
Yes, but
I realize that I did not answer your question, though with theming you should be able to create a totally different search form (if I understand the page I referenced before). With a theme function you can change the content and layout, not just the CSS.
In looking through search.module, I don't see that "Search" or "Advanced search" (the two possible button values) are used anywhere in the code. So, I concur with your confusion/frustration about why your change breaks the search module. I don't even see where the "Advanced Search" form is generated!
My only remaining suggestion would be to try your change with the latest version of search.module.
---
Work: BioRAFT
Search
The submit button for the search form is declared in search.module (function search_form) on line 996 (<?php-tags only for syntax coloring):
The advanced search button is declared in node.module (function node_form_alter); the advanced search form starts at 2099, the submit button is declared at line 2153:
Here you see some FAPI power in action. As you can see, Advanced search is a t-ified string, which means it can be replaced by using the locale module.
--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.
almost got there myself
I just came across these pages:
http://drupal.org/node/24593
http://drupal.org/node/35037
...and was going to suggest trying the method of using the locale module. Thank you for the more definitve answer!
If this suggestion works, I'll try to summarize this into a handbook page (since I've also just been reading this thread: http://drupal.org/node/42242).
---
Work: BioRAFT
Erm
http://drupal.org/node/24593 is already a handbook page; perhaps you can expand on it if necessary?
--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.
To be more specific
I've spent much more time looking in the Customization and theming handbook, and that's where I already looked unsuccessfully for this sort of "customization" technique. So, I'd like to see at least a short page or a worked example there, perhaps with a broader array of key words. Using the search terms that would occur to me, neither of the above-referenced handbook pages come up in the first couple pages of search results. In the admin page, the description of the locale module "Enables the translation of the user interface to languages other than English.", also does not suggest this other function.
I'd just been fretting over how to change some of the block messages in OG, and had previously done it as my friend describes above- opening up the module itself and replacing the text. Obviously this creates problems (especially now for everything 4.7-related that's constantly being updated), since at a minimum this requires making the same changes (manually or via patch) for every new version of the module. Now, looking at the og.module code, it become clear that this same technique applies.
---
Work: BioRAFT
documentation issue
I've created a new Handbook page related to this thread, and opened a Documentation issue:
http://drupal.org/node/58285
I would greatly appreciate your feedback.
---
Work: BioRAFT
why in the node module?
PS- I'm curious as to why the advanced search is in the node module?
Also, do you know of a way to link directly to an expanded advanced search form?
Thanks again!
---
Work: BioRAFT
If it's the submit button in <?php print $search_box ?>
Then you need to change the text output t() line 1040 in search.module which looks like
or search for it's function...
Ben W
.
[please delete]
[please delete]
[please delete]