When adding a 'Content Search form' search box, changing the 'Override default prompt' settings (the checkbox and the custom text) has no effect on the rendered search label.
It seems in panopoly_search/plugins/content_types/search_box/search_box.inc, the following line is overriding any custom/optional input from the interface:
function panopoly_search_search_box_content_type_render....
...
$block->content['basic']['keys']['#title'] = t('Enter your keywords');
...
Even though above this line in the function above, there does seem to be customization settings being assessed:
$prompt = $conf['override_prompt'] ? $conf['prompt'] : NULL;
$form_state = array(
'build_info' => array(
'args' => array($path, $keys, $conf['type'], $prompt),
),
);
I think the block->content
'#title' key/value supersedes the $prompt
value - not super familiar with the PHP API though.
As a temp fix, I replaced "t('Enter your keywords');" with "$prompt" and now I can successfully change the label text for the search box in the pane UI, however there is no default value using this hack, and when 'Override default prompt' is then deselected, there is no fallback text value being used, so the label isn't output at all.
According to https://api.drupal.org/api/drupal/modules!search!search.module/function/..., not putting any value in here would default to "t('Enter your keywords')."
Comment | File | Size | Author |
---|---|---|---|
#2 | 0001-Hacked-panopoly-to-get-search-settings-to-render.patch | 1.49 KB | amaisano |
Comments
Comment #2
amaisano CreditAttribution: amaisano commentedComment #3
Shiraz DindarJust discovered this issue myself. Patch works. Thanks!
Comment #5
dsnopekThanks, for the patch! Worked great in my testing, so committed. :-)
Comment #6
amaisano CreditAttribution: amaisano commentedAwesome - thanks for committing!
Comment #9
dsnopekUnfortunately, this patch broke our automated tests because we had a Search pane which overrode the prompt but the tests were expecting it NOT to be overridden. :-) So, I updated those pages to not override the prompt to preserve previous behavior. Hopefully, this will pass tests now!