I am applying to have my sandbox project, pslinkblocks, promoted to full project status.

This project creates a module that implements two blocks: one containing the Main Links (formerly known as primary links), and the other containing the Secondary Links, as configured on the Menu Settings page.

This project came out of a usability frustration with the Menu Blocks module: I could not figure out a way to create a block containing the Secondary Links (especially when they are defined to be the 2nd level of the Main Menu). Since the Menu Blocks module has a more complex UI, targeting more complex use cases, I decided that it would be useful to have a simple module targeted specifically to the primary/secondary links use case, rather than try to add this functionality to the Menu Blocks module.

Project page: http://drupal.org/sandbox/paulmckibben/1478876
Git repository: git clone http://git.drupal.org/sandbox/paulmckibben/1478876.git pslinkblocks
This is for Drupal 7 only.

Thank you.

CommentFileSizeAuthor
#17 automated3.txt421 bytesdark-o

Comments

patrickd’s picture

Status: Needs review » Needs work

welcome,

Please take a moment to make your project page follow tips for a great project page.

Please take a moment to create a README.txt that follows the guidelines for in-project documentation.

You are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.
(At least this has to be done before switching back to needs review)

while waiting for an in-depht review of your module you can start out fixing some coding style issues detected by automated tools:
http://ventral.org/pareview/httpgitdrupalorgsandboxpaulmckibben1478876git

You can also get a review bonus and we will come back to your application sooner.

regards

paulmckibben’s picture

Status: Needs work » Needs review

patrickd, thank you for your quick response. I've moved the code to the 7.x-1.x branch and have cleaned out the master branch. I've also added a README.txt. Finally, I've fixed the whitespace issues identified by the ventral code reviewer.

tonybuckingham’s picture

Status: Needs review » Needs work

Pretty straighforward module; can't find anything really wrong with it.

The only thing I would point out is that, while the "blocks" module is enabled by default, it is, in theory, a module a user could disable. Since this module explicitly makes reference to functionality provided by the "blocks" module, I would add a dependency on the "blocks" module to your info file:

dependencies[] = "blocks"
paulmckibben’s picture

Status: Needs work » Needs review

tonybuckingham, thank you.

I've updated the info file, adding a dependency on the core block module.

chertzog’s picture

The drupal menu system automatically generates blocks for each menu.

So if i understand this module correctly, if I have 2 menus: menu-1 and menu-2, and they are set as primary and secondary links respectively, I will now have 2 blocks that output each menu. 1 from the core menu and block system, and the other from your module.

I dont really see the point of this module, its just duplicating what core menu and blocks does. Maybe I'm missing something.

From menu.module:

/** 
 * Implements hook_block_info(). 
 */ 
function menu_block_info() { 
  $menus = menu_get_menus(FALSE); 
  
  $blocks = array(); 
  foreach ($menus as $name => $title) { 
    // Default "Navigation" block is handled by user.module. 
    $blocks[$name]['info'] = check_plain($title); 
    // Menu blocks can't be cached because each menu item can have 
    // a custom access callback. menu.inc manages its own caching. 
    $blocks[$name]['cache'] = DRUPAL_NO_CACHE; 
  } 
  return $blocks;
}

/** 
 * Implements hook_block_view(). 
 */ 
function menu_block_view($delta = '') {
  $menus = menu_get_menus(FALSE); 
  $data['subject'] = check_plain($menus[$delta]); 
  $data['content'] = menu_tree($delta); 
  // Add contextual links for this block. 
  if (!empty($data['content'])) {
    $data['content']['#contextual_links']['menu'] = array('admin/structure/menu/manage', array($delta));
  } 
  return $data; 
}
patrickd’s picture

As far as I understand this, the purpose is to create two blocks for one menu

example menu structure (menu with subitems):

- About us
- Products
  - Product 1
  - Product 2
  - Product 3
- References

When I'm on Products the one block will only show
- About us
- Products
- References

And the other block show the sub-items
- Product 1
- Product 2
- Product 3

At my firm we commonly printing out the menu two times and hiding them conditionaly by css, but this module may is a nice alternative

paulmckibben’s picture

patrickd is correct: the use case is when the secondary links are set to be the second level of the same menu that generates the main links.

chertzog, I agree that if your main and secondary links come from different menus, this module is unnecessary. It's only when the come from different levels of the same menu that this module is useful.

chertzog’s picture

Ok. My bad. Just a little case of misunderstanding. Would you consider maybe changing the name of the module to something like second level menu blocks or menu children blocks? I think this would help reduce any confusion about what the module does. Just a thought...

paulmckibben’s picture

Chertzog, how about "Main Links and Secondary Links Blocks"? This terminology would be consistent with the terminology used at admin/structure/menu/settings. I'd prefer to be consistent.

Thanks,
Paul

dark-o’s picture

I am trying to review your module, I tried to check this out but I am only getting README.txt file, I tried :
git clone http://git.drupal.org/sandbox/paulmckibben/1478876.git pslinkblocks
and
git clone DarkoKantic@git.drupal.org:sandbox/paulmckibben/1478876.git

am I missing something, sorry I am new to git

Thanks

Darko

patrickd’s picture

git clone http://git.drupal.org/sandbox/paulmckibben/1478876.git pslinkblocks
this will clone the master branch, as the code lies in the 7.x-1.x branch you got to switch over:
git checkout 7.x-1.x

git clone DarkoKantic@git.drupal.org:sandbox/paulmckibben/1478876.git
This would only work if you got write access to the sandbox's repository and would allow you to push into it.

dark-o’s picture

Assigned: Unassigned » dark-o

ok, it worked like this
git clone --branch 7.x-1.x DarkoKantic@git.drupal.org:sandbox/paulmckibben/1478876.git

So I got your files now

reviewing....

dark-o’s picture

Question;

Does your module support hierarchical menus. I included one of my hierarchical menus as a secondary links. The block was created OK, but when I included it in the Sidbar First only the first level of menu items was showing. I would expect it to be expandable if there are sub menu items, like navigation menu block.

patrickd’s picture

Don't forget to remove the assigning when your done.

dark-o’s picture

yep, still reviewing, just waiting for answer to above question

thanks

dark-o’s picture

Assigned: dark-o » Unassigned
Status: Needs review » Needs work

Automatic review
----------------------------
see attached file bellow

Manual review
------------------

I created blocks as advised, it worked, however hierarchy of the menu was not carried in the Secondar Links block. I expected it to behave like Navigation menu, i.e when I include Navigation menu in the right hand side column I can expand end colapse menu items. If this (non expandable menu items) is expected behavior than please document it in README.

dark-o’s picture

StatusFileSize
new421 bytes

automated review

klausi’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. Feel free to reopen if you are still working on this application.