For some reason I didn't search before creating my own custom module for doing this. They even share the same namespace :(

I thought that I would share mine in case you find anything useful. It appears to work in the same manor as yours, but of course this is based around D7.

Core principle is that the subsite is any item that is tagged to a custom menu that is created during the installation of a subsite. The subsite itself is an fieldable entity, that has a few custom core properties such as theme, title, etc. The only front end page is a simple node-like page listing. While the base schema suggests integration with all entities, only node entity support is built in atm.

The only real issue that I found was with the menu breadcrumb paths, being attached to a menu outside of the core 4 menus results in no menu from showing. That is why these are tagged onto the end of the variable 'menu_default_active_menus'.

Other than that, access (wasn't required) and path alias (manual will do for us atm) are the only real outstanding issues. It is very young and it has had only minimal testing. Hopefully you find something useful :)

CommentFileSizeAuthor
subsites.zip10.69 KBAlan D.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yareckon’s picture

Hey, this looks like an elegant solution in a lot of ways. Could you confirm that this code is under the GPL v2+ or include a LISCENCE.txt file copied from another drupal.org module?

Are you interested in working on the D7 version of subsites to upgrade it to use entities? For instance, I find that the current subsites module has a couple of advantages such as path based selection, and the ability to configure all blocks (not just the subsite menu block) to change their visibility based on whether one is in a subsite.

I would be happy to work with you on this.

Thanks!

Alan D.’s picture

"Could you confirm that this code is under the GPL v2+"

Sure is :)

After finding this module and having had no timely response, I renamed my one to avoid any update status issues. It is likely to have diverged over the last few months, but happy to send it through if you want to compare.

While untested, I think that the menu insertion is no longer needed with drupal v7.10 or so, this was a workaround for core not picking up the active breadcrumb trail, and again, fuzzy on the old code.

This may need work in regards to the menu access hook. I fixed a bug in my version today that returned false on URL's outside of "sub-site/ID", meaning that you couldn't add a menu item or alias in the admin section, etc.

I also had to exclude the custom theme from returning anything when called from paths like "user/*". Calling menu_get_item() within this function actually invokes a second initialization of the theme, and that returns an invalid response. While we are not using it, checking arg(0) != 'user' was enough to neutralize this issue.

Otherwise, it appears to be working nicely.

No time to invest in moving this forward but I may be able to help with the odd question or two

Stomper’s picture

So what's this renamed module called now? Is it on Drupal.org? Is it a D7 subsite equivalent or serving another purpose?

Alan D.’s picture

No, I just renamed mine and went with it. I am not sure what the current maintainer is doing :(

Simon Georges’s picture

There's a 7.x-1.x version of subsites module in the repository, so you can clone it from git.

Alan D.’s picture

Title: Duh. I just done a D7 module for this » D7 port
Status: Active » Closed (duplicate)