Modifying Search block default options

Post

Posted
Rating:
Item has a rating of 5 Item has a rating of 5 Item has a rating of 5 Item has a rating of 5 Item has a rating of 5 (Liked by Adam Edington)
#436 (In Topic #142)
I have noticed that quite often when I try to find contents from my site using Search block, I have to open the Options menu  and tick Catalogue entries or some other non-default option in order to get the desired results.

I have not managed to find out how  to define which search content options are selected as default?

Post

Posted
Rating:
Item has a rating of 5 Item has a rating of 5 Item has a rating of 5 Item has a rating of 5 Item has a rating of 5 (Liked by Adam Edington)
#438
Hi,

There is a way to change the top_search block's defaults, but it's too fiddly to explain reasonably.

I think we should make this better, so I've added it to the tracker:
0002378: Allow configuration of search defaults, outside block options - Composr CMS feature tracker
In the past we were very frugal about adding new config options, but that's no longer an issue with Composr as we've improved our configuration subsystem.

For now though it's easiest to just manually alter the PHP code.

If you look in the sources/hooks/modules/search/*.php files you'll find some have:

Code

$info['default'] = false;
change to:

Code

$info['default'] = true;
as you desire.

Then save under sources_custom/hooks/modules/search/

Post

Posted
Rating:
#439
Thanks Chris,

I tried immediately, and it works :thumbs:

I guess the logic is that php files in sources_custom have priority over files in sources, right?

Post

Posted
Rating:
#440
Yes, priority, and protected from automatic overwrite during upgrades. :)
1 guest and 0 members have recently viewed this.