Follow-up to #2831116: Coding Standards

  1. +++ b/chosen.admin.inc
    @@ -13,7 +13,10 @@ function chosen_admin_settings($form, &$form_state) {
         drupal_set_message(t('The library could not be detected. You need to download the !chosen and extract the entire contents of the archive into the %path directory on your server.',
    -    array('!chosen' => l(t('Chosen JavaScript file'), CHOSEN_WEBSITE_URL), '%path' => 'sites/all/libraries')
    +      array(
    +        '!chosen' => l(t('Chosen JavaScript file'), CHOSEN_WEBSITE_URL),
    +        '%path' => 'sites/all/libraries',
    +      )
    

    This is an incorrect fix. l() must not used here.

  2. +++ b/chosen.install
    @@ -12,13 +12,15 @@ function chosen_requirements($phase) {
    +          'description' => $t('You need to download the !chosen and extract the entire contents of the archive into the %path directory on your server.', array(
    +            '!chosen' => l($t('Chosen JavaScript file'), CHOSEN_WEBSITE_URL),
    

    Same bug again

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hass created an issue. See original summary.

nagy.balint’s picture

Thanks for the report.

Of course that l function was there before, the coding standard patch only changed the formatting and such.

nagy.balint’s picture

This is likely the reason why this is bad:
https://www.drupal.org/node/322774

As the "Chosen JavaScript file" in the current implementation is not translatable together with the whole sentence, only separately.

Of course this also means that the markup for the link has to enter the string and wont be rendered by Drupal, but its likely the smaller problem.

So the fix is likely something like:

drupal_set_message(t('The library could not be detected. You need to download the <a href="@chosen-js-file">Chosen JavaScript file</a> and extract the entire contents of the archive into the %path directory on your server.', array(
     '@chosen-js-file' => CHOSEN_WEBSITE_URL,
     '%path' => 'sites/all/libraries',
 ));
nagy.balint’s picture

Status: Active » Needs review
FileSize
1.77 KB
hass’s picture

Status: Needs review » Reviewed & tested by the community

That is correct.

  • nagy.balint committed a06ea45 on 7.x-2.x
    Issue #2864120 by nagy.balint, hass: Coding Standards - fixed...
nagy.balint’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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