This module enables the user to add a marker to any menu item.

Features:

  • Allows to add any custom text as marker or use pre-defined markers (New, Updated)
  • Ability to change the position of the marker for each menu item

Compatibility:

This is a very simple module to add the popular markers like New, Updated or any custom text but doesn't allow any other html in menu title.
Morever, the html tags 'sup', 'sub', or 'span' is added by the module itself and no user input is needed for that, thus avoiding any security issues.

As this module doesn't allows user to add any html in the menu title, it can be made available to non-admin users too.

This module is meant for a specific purpose. For advanced usage, Menu Html is recommended.

Project link:

Git:

Drupal version:

  • 7.x

Reviews

  1. https://drupal.org/node/2011366#comment-7531065
  2. https://drupal.org/node/2012340#comment-7603167
  3. https://drupal.org/node/1984206#comment-7602147

Comments

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://ventral.org/pareview/httpgitdrupalorgsandboxabhiteshdas1945902git

We are currently quite busy with all the project applications and I can only review projects with a review bonus. Please help me reviewing and put yourself on the PAReview: review bonus high priority list. Then I'll take a look at your project right away :-)

I'm a robot and this is an automated message from Project Applications Scraper.

abhitesh.das’s picture

Status: Needs work » Needs review

1) Deleted master branch.
4) Code has been fixed: http://ventral.org/pareview/httpgitdrupalorgsandboxabhiteshdas1945902git

arun ak’s picture

Status: Needs review » Needs work

Hi,

In marker settings page there is an option as 'Select marker position'.

I think its better to make this setting as link specific.

abhitesh.das’s picture

Status: Needs work » Needs review

Thanks for the suggestion! :)

Made 'Select marker position" link specific.

Please review again.

bkonetzny’s picture

Nice and clean module, installation went as expected.

At the moment, the marker is always appended to the link text. Maybe an option to choose (prepend, append) on a per-link basis would be nice?

Theres a formatting issue in menu_marker_form_alter():
http://ventral.org/pareview/httpgitdrupalorgsandboxabhiteshdas1945902git

FILE: /var/www/drupal-7-pareview/pareview_temp/menu_marker.module
--------------------------------------------------------------------------------
FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------
128 | ERROR | Functions must not contain multiple empty lines in a row; found
| | 3 empty lines
130 | ERROR | More than 2 empty lines are not allowed
--------------------------------------------------------------------------------
abhitesh.das’s picture

Hi bkonetzny,

This seems to be a pretty useful feature. I will work on it.
For now, I have fixed the formatting issue.

Thanks.

Anonymous’s picture

Hey,

Concerning theme_link and theme_menu_link: I'm wondering if it's a good idea to place the overrides of these template functions in a .module file? Isn't there a hook you can use so you don't need to make your alterations on the theme layer level?
For example, if someone who doesn't know much about how Drupal works downloads your module and overwrites theme_menu_link him/herself in the template.php file, that would stop your module from working.

On line 246 of your .module file you have a string not between the t() function: if ($marker_text == 'Other') { I think if the string on line 107 gets translated 'other' => t('Other'), it won't be picked up anymore.

Other than that your code looks nice.

abhitesh.das’s picture

I could not find any hook to implement it. I will still spend some more time in this direction. Please let me know if you come across something that we could use here.

Moreover, when I try this module with Menu CSS Names, it works fine. This module is also implementing the theme_menu_link() and works perfectly fine with my module.

On line 246 of your .module file you have a string not between the t() function: if ($marker_text == 'Other') { I think if the string on line 107 gets translated 'other' => t('Other'), it won't be picked up anymore.

It would work perfectly as we are storing the key and not the value & key remains the same always.

However, I have removed an extra t() from the module code.

Thanks. :)

hkirsman’s picture

Great module!

There's a bug that should be fixed though :) After you set the marker and later try to change it (for example from sub to sup), changes don't appear on site. Clearing cache fixes things.

Minor stuff. You don't need quotation marks around description value in .info file.

edutrul’s picture

Title: Menu Marker » [D7] Menu Marker

Changed Issue title. FYI: http://drupal.org/node/1011698

chetan-singhal’s picture

Hi Abhitesh

This is not good practice to add css/js in hook_init. hook_init call on every page load.
So please replace this in theme.

Js/Css should be add in theme.

chetan-singhal’s picture

Status: Needs review » Needs work

Hi Abhitesh

This is not good practice to add css/js in hook_init. hook_init call on every page load.
So please replace this in theme.

Js/Css should be add in theme.

abhitesh.das’s picture

Thanks :)

abhitesh.das’s picture

@edutrul : Thanks :)

@hkirsman : Thanks for your input. I have removed the extra quote from the .info file. The cache issue is fixed too.

abhitesh.das’s picture

@cpsinghal:

Hi,

Although your point is valid, this module works for menu item which would be present on almost all the pages. Moreover, the size of the css file is just 60 bytes.
Please let me know if there is any other way to achieve this. It would be highly appreciated.

abhitesh.das’s picture

Status: Needs work » Needs review
labor b’s picture

I think what cpsinghal is trying to tell you, is that's generally a bad idea to invoke a function inside hook_init, when there are other possibilities.
In your case, I would just drop the whole css file & use drupal's own classes for marking new menu entries.
For example the node module uses the class "marker" to mark updated entries.

<span class="marker">updated</span>

You should somehow get rid of these overly long lines (like line 188). It's really difficult to read them.

ronfeathers’s picture

Nice module!
A couple of small things:

  • Code formatting: you have some very long lines. It would be great to apply some formatting, and stick to the convention of nothing longer than 80 chars
  • When the marker is added, can you apply the Drupal "marker" class?
  • You might also add a link to help on the config page which is where you get a little more info on what this module does

Otherwise, great job. Looks helpful!
~R~

jamiehollern’s picture

Status: Needs review » Reviewed & tested by the community

This is a really cool little module, good job. I couldn't find any obvious issues with it so I only want to mention the parentheses for the following potential enhancements:

  • It would be nice if the user could dictate what parentheses is going to be used. So have brackets () as a default, but allow them to choose other types of parentheses such as [], {} and <>. Custom text would be good too, much like your "Other" marker text option.
  • Perhaps it would be better if the user could choose to wrap the markers on a menu by menu basis as opposed to a global option. I'd potentially keep the global option in the module, but allow local (menu specific) overrides. I'd also combine with the above point so that there would be a global default but local parentheses options.

Otherwise, good job. I really like the look of this. I'm marking as reviewed and tested by the community.

abhitesh.das’s picture

@ronfeathers, @labor b, @cpsinghal :
I have applied the default class "marker" to the marker. Hence, removed the css file as there it is not needed any longer.

@jamiehollern, @bkonetzny:
Below are the potential enhancements:
1. Option to select append/ prepend.
2. Option to select the type of braces viz. {}, (), <>

Thank you all for your help and suggestions.

abhitesh.das’s picture

Issue summary: View changes

Modified the feature #2 as we have made the functionality menu specific rather than global.

abhitesh.das’s picture

Issue tags: +PAreview: review bonus

Added reviews.

klausi’s picture

Status: Reviewed & tested by the community » Fixed

manual review:

  1. menu_marker_permission(): doc block is wrong.
  2. menu_marker_form_alter(): use hook_form_FORM_ID_alter() instead if you are only targeting one specific from.

But that are not application blockers, so ...

Thanks for your contribution, abhitesh.das!

I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

abhitesh.das’s picture

Fixed the issue reported by Klausi.

@jamiehollern, @bkonetzny:
Enhancements:
1. Option to select append/ prepend. - Done
2. Option to select the type of braces viz. {}, (), <> - Not done. For now, user can add any kind of bracket while entering custom text for the marker.

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

Anonymous’s picture

Issue summary: View changes

Added reviews