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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

amaisano created an issue. See original summary.

amaisano’s picture

Shiraz Dindar’s picture

Just discovered this issue myself. Patch works. Thanks!

  • dsnopek committed d94b5b9 on 7.x-1.x
    Update Panopoly Search for Issue #2560753 by amaisano: Search block pane...
dsnopek’s picture

Status: Active » Fixed

Thanks, for the patch! Worked great in my testing, so committed. :-)

amaisano’s picture

Awesome - thanks for committing!

  • dsnopek committed 463febc on 7.x-1.x
    Revert "Update Panopoly Search for Issue #2560753 by amaisano: Search...
  • dsnopek committed 5d72da6 on 7.x-1.x
    Update Panopoly Search for Issue #2560753 by amaisano: Search block pane...

  • dsnopek committed 44ba319 on
    Update Panopoly Search for Issue #2560753 by amaisano: Search block pane...
  • dsnopek committed a23c30e on
    Revert "Update Panopoly Search for Issue #2560753 by amaisano: Search...
dsnopek’s picture

Unfortunately, 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!

Status: Fixed » Closed (fixed)

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