Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If the base_path() is '/' this code below removes all '/' from the $href and what I can see is that it should only remove the base_path in the begining of $href. Or am I wrong?
// theme.inc:46 in calendar_preprocess_date_views_pager()
$part_path = str_replace(base_path(), '', $href);
// example
// $href = '/calendar/month/2011-10'
// base_path() is '/'
// $part_path is then 'calendarmonth2011-10'
If I right, a suggestion for a solution to the problem is
$part_path = (strpos($href, base_path()) === 0) ? substr($href, strlen(base_path())) : $href;
// if the base_path() always is first in the $href it could be
// $part_path = substr($href, strlen(base_path()));
// preg_replace may also be used and set the limit to 1, but I am not sure if it is a good idea to use that function when base_path could be / and what I know it is not so good to have that as a pattern in regex expressions.
Comment | File | Size | Author |
---|---|---|---|
#4 | 0001-Fix-for-base_path-of-which-causes-the-Year-Month-Wee.patch | 1.07 KB | drewkeller |
Comments
Comment #1
Scyther CreditAttribution: Scyther commentedSee next comment
Comment #1.0
Scyther CreditAttribution: Scyther commentedRewriten
Comment #2
Scyther CreditAttribution: Scyther commentedThe issue above also seems to be error causing the
Notice: Undefined index: access in calendar_menu_local_tasks_alter() (line 50 of /public_html/sites/all/modules/calendar/calendar.module)
in #1265590: My "month | week | day | year " navigation menus are gone from the calendar.Comment #3
drewkeller CreditAttribution: drewkeller commentedI changed it to
$part_path = substr($href, strlen(base_path()));
and got this output for dvr($calendar_links):This does seem to fix the issue and I get the links at the top in whatever style the active theme shows for 'tabs'.
Comment #4
drewkeller CreditAttribution: drewkeller commentedI attached the patch in the other thread but i'll attach it here, too. If I mark the status for patching, I assume it will help get it applied?
Comment #5
Scyther CreditAttribution: Scyther commentedIf the maintainers agree that this fixes the problem they will probably apply it. But it may need some more testing from others.
Could any maintainer comment about this issue?
Comment #6
arlinsandbulte CreditAttribution: arlinsandbulte commentedCode makes sense to me.
I will test a little more and commit if all goes well or if KarenS has no objections...
Comment #7
Scyther CreditAttribution: Scyther commentedAny update on this?
Comment #8
arlinsandbulte CreditAttribution: arlinsandbulte commented#4 committed:
http://drupalcode.org/project/calendar.git/commit/4dbc7dd
Comment #9.0
(not verified) CreditAttribution: commentedAdded some info