Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JohnAlbin’s picture

Kreativs’s picture

subscibe

enkara’s picture

subscribing

santam’s picture

subscribing

Jarek_Sz’s picture

subscribe

psnabe’s picture

Any news about this?

jonasdowney’s picture

subscribe

ryan.armstrong’s picture

sub. Saw your presentation at Chicago John, looking good!

BenK’s picture

Also subscribing after attending your DrupalCon presentation... looking forward to this in D7!

--Ben

ckrina’s picture

subscribe

KirstenLangholz’s picture

Subscribing and kindly asking for a time frame....thank you so much!!!!

NPC’s picture

Subscribing :)

Countzero’s picture

Subscribing. This is much needed for advanced menu management in D7. I'll have a look to see if I can be of any help.

Thanks for your work.

Countzero’s picture

I worked on the port yesterday, but I must say there is really a lot of work to be done :

- the menu system completely changed
- the database API too
- the form API too

So updating the code for the management forms (with validations and submit functions, and the correct menu arrays) tends toward a complete rewrite.

I'm asking myself if starting from scratch wouldn't be a better option.

What do the maintainers think about this ?

dgastudio’s picture

sub

ovg’s picture

There is another module: http://drupal.org/project/special_menu_items, with a d7 version that worked for me: http://drupal.org/node/1007054#comment-4370936.

vishalkhialani’s picture

this link is for d6 not d7. Did you make some changes ?

cheers,
Vishal

gagarine’s picture

This module is almost the same than special menu item. They should fusione. This is not an hard task they are very simple module.

I'm for keepking special menu item because they are way more user. So I don't think we should make a D7 version of this module. As mentioned they is already a port https://github.com/webflo/special_menu_items so fork it and add the features you want to see (it's fast is on github for the moment).

ovg’s picture

@Vishal: the file I downloaded on the 1st of June also had 6 in the file name, but it really had 7 inside. I see they have fixed that now.

vishalkhialani’s picture

@ovg: thanks I got it done :)

lsancheztapia’s picture

subscribe

bocaj’s picture

I prefer this module over Special Menu Items (just personal preference) and am in the middle of a website that I needed this functionality for. I decided that I would pick up where @JohnAlbin left off on the D7 port.

Below is a patch and the complete module for anyone else that is interested.

The patch is rolled against: http://drupal.org/node/1014334/release?api_version[]=103 (January 23, 2011)

EDIT: Don't use this patch/zip file! Use one below instead.

bocaj’s picture

Status: Active » Needs review
FileSize
13.82 KB
13.9 KB

As I got more into the project I realized that there were some things that I missed :-/

Here is an update that hopefully fixes things a little better!

keva’s picture

Installing the module in #23 gave this error:

Notice: Array to string conversion in menu_item_container_clean_breadcrumb() (line 104 of .../sites/all/modules/menu_item_container/menu_item_container.module).

Then adding a container in the menu gave these errors:


Notice: Undefined index: #attributes in _menu_item_container_form_menu_edit_item_alter() (line 122 of /sites/all/modules/menu_item_container/menu_item_container.admin.inc).

Notice: Undefined index: class in _menu_item_container_form_menu_edit_item_alter() (line 122 of /sites/all/modules/menu_item_container/menu_item_container.admin.inc).

Notice: Array to string conversion in menu_item_container_clean_breadcrumb() (line 104 of /sites/all/modules/menu_item_container/menu_item_container.module).

The menu item is created, but instead of being a container, it's a link with path "/menu-item-container/1" (note: the container link appears in a Nice Menu; in the menu edit screen at admin/structure/menu/manage/main-menu/list, the container does not have a link).

Clicking "edit" for the container gives these errors:

Notice: Undefined index: #attributes in _menu_item_container_form_menu_edit_item_alter() (line 122 of /sites/all/modules/menu_item_container/menu_item_container.admin.inc).

Notice: Undefined index: class in _menu_item_container_form_menu_edit_item_alter() (line 122 of /sites/all/modules/menu_item_container/menu_item_container.admin.inc).

Notice: Undefined index: #below in theme_menu_item_container() (line 182 of /sites/all/modules/menu_item_container/menu_item_container.module).

Notice: Undefined variable: sub_menu in theme_menu_item_container() (line 192 of /sites/all/modules/menu_item_container/menu_item_container.module).

Notice: Array to string conversion in menu_item_container_clean_breadcrumb() (line 104 of /sites/all/modules/menu_item_container/menu_item_container.module).
bocaj’s picture

@keva: You are correct on the Nice Menus issue. I don't know Nice Menus well enough to know how to handle it. Maybe someone here will know of a way to handle the Menu Item Container "links" when presented in Nice Menus. If I get a chance I will look into it, but since I don't (or rarely) use Nice Menus I'm not sure when that would be.

The "errors" that you are referring to are actually notices (as you can see each line starts with "Notice:"). From what I understand from what I've read Drupal 7 changed the error reporting settings from Drupal 6, in order to get ready for the new requirements/recommendations of PHP 6 (I think)? Anyway, as you can tell I'm not completely sure of the exact changes, but I found a blog post (http://www.citytree.be/blog/undefined-index-quick-fix-in-drupal7-error-r...) that tells how to get rid of those notices. Unfortunately it seems to get rid of legitimate errors as well so beware of that if you are a developer.

Having said all that, those notices are probably something that should be addressed anyway, so if/when I get a chance I will try to reroll a patch that eliminates those.

santam’s picture

The same issue is seen with the superfish module as above

podarok’s picture

Issue tags: +D7 porting

subscribe

EvanDonovan’s picture

From what I remember of John Albin's Chicago presentation, this module has a better architecture than Special Menu Items so I would support its being ported in preference to that module.

Is #23 the most recent work done on a port?

gagarine’s picture

I change the architecture of the D7 version of Special Menu items (I didn't write the D6). But what I really want is #1287610: Create a Menu Item Type API so we can fusion those two module and also menu first child.

bocaj’s picture

Here is an updated version I put together that should take care of the PHP notices mentioned in #24 and added preliminary support for Nice Menus module.

Still needs a lot of testing and could probably use a good code review.

One thing I did notice that I didn't do anything with is that there is a call to hook_preprocess_page() that is modifying the main and secondary menus. That should probably be pulled out of hook_preprocess_page() and be put into the appropriate menu preprocess function(s).

zroger’s picture

patch does not apply. I'm testing #23 in the meantime.

TaraRowell’s picture

schildi’s picture

FileSize
41.66 KB

Using your module from #30 in combination with "nice menus" or "superfish" always leads to the "notice" that the index "breadcrumb" is invalid. The output of module devel is attached as screenshot to this post.

EDIT:
the problem seems to be at the end of function menu_item_container_clean_breadcrumb when returning some result.
return $function($breadcrumb);
The function "garland_breadcrumb" is called with the empty array "breadcrumb" as argument.

Does this tell something meaningful to somebody?

I am completely unfamiliar with this module but need it. Please help!

couloir007’s picture

subscribe

I'm using Omega and getting the exact same breadcrumb error.

sammys’s picture

FileSize
2.92 KB

Hi there. Thanks for a super module (D6 hehe).

I've had to patch the D7 port further to get it working for live use. The patch applies to the master branch as of 21 Feb (commit 87db3203e4505b2b2cc73e838e5cb81a7df2834f).

The fixes in this patch are:

  • Deleting of a container now works
  • Parent menu default is preselected to be the menu the container is being added to (taken from arg(4):0)
  • Fixes errors with breadcrumb code using $link array as a string
schildi’s picture

@sammys
thank you very much for your efforts and reacting so quickly!
But, sorry, I can't find the commit you pointed to. What I can see is
- a message "There is no code in the master branch ..."
- searching for the commit-ID you provided did not succeed
- last commit seems to be from 14. Dec. 2011

Probably that is my fault since I am not an experienced GIT user. Or is there a larger delay until the recent commit will be visible?

carl.ben’s picture

schildi’s picture

@carl.ben
thanks for the hint. Now I got it.

@sammys
I installed your sources and applied the patch from #35. The formerly described errors don't appear any longer. Only the warnings - as discussed in #24 / #25 - are still present when editing a block
admin/structure/menu/item/[some ID]/container/edit

Notice: Undefined index: #attributes in _menu_item_container_form_menu_edit_item_alter() (line 122 in sites/all/modules/menu_item_container/menu_item_container.admin.inc).
Notice: Undefined index: class in _menu_item_container_form_menu_edit_item_alter() (line 122 in sites/all/modules/menu_item_container/menu_item_container.admin.inc).

And when entering /admin/structure/block or /admin/structure/menu the following message comes up

Notice: Undefined index: menu_name in menu_item_container_route_menu_item() (Zeile 89 von .../menu_item_container/menu_item_container.module)
ceberlin’s picture

Title: Titles not accessible for me vie css » Port to Drupal 7

I need this sort of module right now to structure an overlong menu and I prefer the concept of this module much over Special Menu Item.

I tried the latest GIT version from February 12 - thanks, as always, for the commit!!!

Small bug: If I edit the settings, the Parent link is not shown correctly but something completely different.(fixed with patch from #35 above)

If I may add a small suggestion, since this module is both a menu item and also kind of a block item. I would love very much to have different fields for the Administrative Title (internal name) and the Block Title (headline to display for this sub-block). A behavior which the very cool Menu Blocks Module has implemented for the same reasons. For Example I could use CAPITALS internally and normal writing externally. This makes Parent Item selections within Node edits much more accessible.

ceberlin’s picture

Title: Port to Drupal 7 » Titles not accessible for me vie css

I could not access the titles of the containers via css... just could not get it working. No idea, why...

So I changed something in the module to make them accessible for me (needed some tags around the titles).
Last line in module, added h4 tags - just as a proof of concept:

+ return '<' . $tag . drupal_attributes($options['attributes']) . '>' . (!empty($options['html']) ? '<h4>'.$element['#title'].'</h4>' : '<h4>'.check_plain($element['#title'])).'</h4>' . $sub_menu . '</' . $tag . '>';

So, is this a good idea? - or how would be the proper way to style the titles?
I am a designer, not a coder.... and I would normally NEVER touch modules.
But I needed a quick solution and this D7 module version seems not to be maintained, right now?

JohnAlbin’s picture

Reverting title

ceberlin’s picture

Ups. sorry.

p.michaelis’s picture

subscribe

mikeker’s picture

It seems that the D7 port is getting hung up on compatibility issues with other menu-related modules such as Nice Menus and Superfish (with more to come, I would guess).

I was playing around with getting MIC working on D7 this weekend and through it might be a better approach to move menu compatibility to submodules and provide a couple of hooks (eg: hook_menu_item_container_theme_hooks and hook_menu_item_container_breadcrumbs) which would allow the Nice Menus submodule to tweak the display of containers and breadcrumbs when Nice Menus is enabled.

Advantage is that we could get the "core" MIC module ported to D7 quickly without a lot of if (module_exists('...')) clutter. Downside: lots of little bitty modules which might complicate the installation for newer users.

I'm most of the way to a patch that would do this (it is based on JohnAlbin's commits from #1 plus the patch in #23). But I wanted to see if anyone had thoughts on this approach. Good idea or overzealous abstraction?

bocaj’s picture

@mikeker: I like the idea. If nothing else just temporarily while getting MIC fully D7 compatible. I think that having separate submodules could be nice permanently as well. It would definitely help with maintenance I think and wouldn't be too much of an inconvenience for usability. I'd say post the patch and we can all take a look at it! Thanks for your work on this! I'd love to see MIC get fully integrated with D7. I'm using my patch in #23 for projects now, but it's definitely not ideal.

likewhoa’s picture

Title: Port to Drupal 7 » Port Menu item container to Drupal 7
Component: Code » Miscellaneous
Status: Needs review » Needs work

updating to keep better track of task.

Alexandr.P’s picture

Called from \menu_item_container\menu_item_container.admin.inc, line 122

fix

old

 // Add an additional class to the form.
  $form['#attributes']['class'] .= '  menu-item-container-form';

new

// Add an additional class to the form.
  $form['#attributes']['class'] = 'menu-item-container-form';

Undefined index: menu_name in menu_item_container_route_menu_item()

old

 'menu_item_container__' . str_replace('-', '_', $link['menu_name']),

new

 'menu_item_container__' . str_replace('-', '_', $link['element']['#original_link']['menu_name']),
Alexandr.P’s picture

When you delete a menu item.

Warning: Parameter 1 to menu_item_container_delete_form() expected to be a reference, value given in call_user_func_array() (line 795 of \includes\form.inc). =>

klonos’s picture

Status: Needs work » Fixed

...I say we close this issue here (since it was about creating an initial 7.x version and we do have one now) and file separate issues against the 7.x branch. Reporting all issues related to the 7.x-dev in this single place is confusing and hard to keep track.

JohnAlbin’s picture

Status: Fixed » Needs work

The port in the 7.x-1.x-dev isn't complete. And the patches posted here (and the github repo) haven't been included in this project.

granticusiv’s picture

Issue summary: View changes

Is there an alternative to this module in D7?

SebCorbin’s picture

Yes, see Special Menu Items https://www.drupal.org/project/special_menu_items and its keyword

BTW, Menu Item Container should update its description mentioning this

granticusiv’s picture

Thanks Seb

Mile23’s picture

This module seems to fit my use case where special_menu_items can't.

I want a top-level menu item that isn't a link, that has child links. Maybe I'm missing a feature of SMI.

Anyway, what will it take to move this forward to at least have a dev release?

Help me get rid of the PHP filter menu block they put on this site I'm maintaining! :-)

timfletcher’s picture

I'm in the same boat as @Mile23, special_menu_items causes my PathAuto URL paths to break by adding 'nolink'into them and not respecting pre-set URL values. Instead, menu link URLs are transliterated by PathAuto based on the menu item title...