hi,
making a link with the l() function. and a anchor.

$mylink = l('My Link Name', 'some/existing/path', array('fragment' => <b>"0"</b>));

returns:

<a href="some/existing/path0">My Link Name</a>

and not:

<a href="some/existing/path#0">My Link Name</a>
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

johanneshahn’s picture

sorry
wanna make "0" bold.
mean

$mylink = l('My Link Name', 'some/existing/path', array('fragment' => "0"));
johanneshahn’s picture

Hi,
solve this problem with change common.inc near line 1428 from

if ($options['fragment']) {
    $options['fragment'] = '#'. $options['fragment'];
  }

to:

if ($options['fragment'] != NULL) {
    $options['fragment'] = '#'. $options['fragment'];
  }
johanneshahn’s picture

Version: 6.9 » 6.14
Status: Active » Needs review
johanneshahn’s picture

Status: Needs review » Needs work
Damien Tournoud’s picture

Version: 6.14 » 7.x-dev

Erm. This makes sense. Bumping to Drupal 7: bugs get fixed in the highest affected version, then backported.

dawehner’s picture

Status: Needs work » Needs review
FileSize
1.48 KB

I think checking against a "" string makes more sense

Status: Needs review » Needs work

The last submitted patch, 605552-fragment_check.patch, failed testing.

mr.baileys’s picture

Status: Needs work » Needs review
FileSize
1.8 KB

The tests were failing since NULL !== '', so not setting $options['fragment'] resulted in '#' being incorrectly appended to URLs. Slightly updated patch to account for $options['fragment'] not being set.

Dries’s picture

Status: Needs review » Reviewed & tested by the community

This looks RTBC.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Still looks RTBC so committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)

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