In order to make this fit in my URL scheme better, I wanted to change the base bath from glossary to docs/glossary.

This patch adds another setting to the admin page that lets you change the base path from 'glossary' to something else.

This is a patch against version 1.6 for Dupal 6.

CommentFileSizeAuthor
#3 set_path2.patch16.94 KBNick Urban
set_path.patch7.99 KBNick Urban
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

phpdiva’s picture

The patch seems to be working fine for me.
I think you missed one spot (last line in this function should be also changed):

// Menu call back for link on settings page.
function glossary_clearcache() {
  cache_clear_all('*', 'cache_filter', TRUE);
  drupal_set_message(t('Cache_filter cleared.'));
  drupal_goto('/glossary');
}

Sorry, no patch. Still trying to work out the patching on Windows (the different line endings mess everything up).

Also, a suggestion for glossary_path(). Either do this:

function glossary_path() {
static $glossary_path = NULL;
if ($glossary_path == NULL) {
  $glossary_path = variable_get('glossary_path', 'glossary');
}
return $glossary_path;
}

or perhaps define a constant in the beginning of the module file?

phpdiva’s picture

Status: Needs review » Needs work
Nick Urban’s picture

FileSize
16.94 KB

Fearfox, thanks for the patch check.

I see that I missed that clearcache line. Fixed in this patch.

Regarding caching the results of variable_get, I do not think it is necessary. I looked at the source for variable_get and it does not make a database call; it merely reads from "global $conf", so the static variable seems redundant. Anything I'm missing there?

Nick Urban’s picture

Oh, I forgot, I added a </dd> on line 956 because the <dd> tags were not being closed. I meant to submit that as a separate patch but instead it is in the patch I just submitted.

manoloka’s picture

Has this patch been added to the module?

It seem a good option (especially for other languages)

Any chance to port it?

POVYLAZZZ’s picture

subscribing...

RAFA3L’s picture

subscribing...

yochee’s picture

subscribing too

CMStom’s picture

subscribed.

This patch didnt work, I got a hunk error.

patch -p0 < set_path2.patch
patching file set_path.patch
patching file glossary.admin.inc
Hunk #1 FAILED at 137.
1 out of 1 hunk FAILED -- saving rejects to file glossary.admin.inc.rej
patching file glossary.module

I dont see the option inside the Site Config > Glossary to change the base path.

CMStom’s picture

My glossary.admin.inc.rej file includes:

 ***************
*** 137,150 ****
      '#description' => t('This is the style class that will be used for "acronym," "abbr," and "hovertip" links. It should only be used by those with specific site standards.'),
      );
  
-   $form['glossary_page']['glossary_path'] = array(
-     '#type' => 'textfield',
-     '#title' => t('Base Path'),
-     '#default_value' => variable_get('glossary_path', 'glossary'),
-     '#description' => t('The base path from which user-visible links and menu callbacks are constructed. The default is "glossary". After changing this setting, you will need to rebuild your menu router (for instance, by clearing the cache from the !performance page).', 
-     array('!performance' => l(t('performance'), 'admin/settings/performance'))),
-   );
- 
    return system_settings_form($form);
  }
  
--- 137,142 ----
      '#description' => t('This is the style class that will be used for "acronym," "abbr," and "hovertip" links. It should only be used by those with specific site standards.'),
      );
  
    return system_settings_form($form);
  }
  
CMStom’s picture

I got the patch to work by using this patch command. I did get the message "Hunk #1 succeeded at 137 with fuzz 3" but the patch worked.

This is the command I used:

patch --ignore-whitespace -F3 < set_path2.patch

Hope this helps!

crispin’s picture

The patch in 3 can no longer be applied to the current release

Just tried to update a site to v1.8 of glossary and I could not reapply the patch, we are working on a new one right now, will post it up here hopefully this afternoon...

NancyDru’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)