First things first... Thanks for this veyr useful module.

2 questions...

- How do I get rid of number of links in group title? It appears between braquets and it is very anoying... I couldn't find any way not to display them. I was using it in other website and this never showed up.

- How do I manage to not showing empty groups? Unclassified group appears with zero between braquets...

Thanks again!

psc

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

metabits’s picture

Title: How do I get rid of number of links in group title / ? » How do I get rid of number of links in group title / empty groups ?
kalanh’s picture

Sorry to dig up a dead post, but this thread came up when I Googled the issue and the status is still active. I just did an upgrade from 2.3 to 2.5 and also noticed the link count in the legend. Maybe I hacked the old version, I don't quite remember. Since the node count becomes part of the node->title in weblinks.module, the only way to accomplish this is to hack the string on line 708:

The original is as follows:

$fieldset = array(
  '#title' => $term->title . ' (' . $term->node_count . ')',
  ...

A nice, non-destructive way to target a CSS class in the count and brackets would be to wrap them in a span tag and optionally, add a new CSS class:

$fieldset = array(
  '#title' => $term->title . ' <span class="weblinks-count">(' . $term->node_count . ')</span>',
  ...

This way, you can show or hide the count with your theme's CSS file. For example, to hide the count as psc originally asked, add this to your CSS:

.weblinks-count {
  display: none;
}

Note that while this could be called a "non-destructive" way of modifying the code, it's still a hack and will be lost on a module update. As for empty groups, I believe this has been addressed in the Group Settings section of Weblinks options (leave the "Empty container text" textarea blank):

Empty container text:
This text will appear when a container is empty. Leave it blank to not show the group at all. It will be filtered by your default input format.

jonathan1055’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Issue summary: View changes

Hi,
I've been going through the old Web Links issues attempting to slowly clear the old ones which have been ignored. There are two issues here:

(a) You are quite right that not everyone wants to see the number of links displayed in the fieldset/Group title. I think this is a necessary config option which admins should be able to set.

(b) You mentioned "I believe this has been addressed in the Group Settings section of Weblinks options (leave the "Empty container text" textarea blank)" and yes it should have been addressed, but I've just tested this against 6.x-2.6 and it seems to ignore this and still show the group even if the text is blank. This has been fixed in 7.x-1.0 so if we think it is worth it I could find the commit and port it back to 6.x.

Jonathan

GStegemann’s picture

Quoted from #1103074: Link Count in Group Header doubled up for anon users:

Gerhard, what do you think about this? It could be (yet another) configurable option and we could omit the count and/or wrap it in a span style so that it can be themed (or supressed) by css.

I think it makes sense to have both: count displayed or suppressed. I would suggest to implement a Links Page configuration option 'Display number of Links in Group Title' -> Yes/No and wrap the count in a span style as proposed in #2.

Gerhard

jonathan1055’s picture

Title: How do I get rid of number of links in group title / empty groups ? » Option to display or suppress number of links in group title
Category: Support request » Feature request

Thanks, Yes I'll do that.

For (b) I've just re-tested 6.x and the 'Empty Group Text' feature is working OK. For some reason, after moving the links out of one group it needed a full clear cache before the change became apparent to the anon user. But that's fine, it was probably some other cache setting I had enabled. I have adjusted the title of this issue accordingly, as it is now solely about the new option

jonathan1055’s picture

Status: Active » Needs review
FileSize
1.8 KB

Here's a patch against 7.x-1.0+4 which gives an option for displaying or hiding the node count and also adds a span tag to the number. I have included an example in the .css file, but commented it out to match the other examples.

GStegemann’s picture

Status: Needs review » Reviewed & tested by the community

Tested and works. Thanks.

  • jonathan1055 committed 7b38d75 on 7.x-1.x
    Issue #839418 by jonathan1055, kalanh: Option to display or suppress...
jonathan1055’s picture

Status: Reviewed & tested by the community » Fixed

Thanks. I also remembered to add a changelog.txt row too.

If anyone specificaly requests for this feature to be ported to 6.x then I will do that, but unless and until someone asks then I am leaving this as fixed at 7.x

Status: Fixed » Closed (fixed)

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