Hi there,
I wonder if you could help me with the following menu-related problem:
Background
I have set up several domains using the Domain Access module and have created one menu per subdomain and added each to the menu region of my Omega theme as a 'Superfish menu' block. On the menu block's Visibility Settings > Domains - 'Display on' option, I have ticked the relevant subdomain for each menu. I have one theme for my root domain and another for subdomains. On the theme settings for the subdomains I have disabled the main menu since I am creating my own.
Problem
I would like, when adding content (specifically a 'basic page') to a subdomain and using the Menu settings > Provide a menu link option, to be able to choose the subdomain's menu, however, the only menu that appears on the dropdown menu is the Main Menu.
Action taken
I have tried to make each subdomain's menu available by editing the settings on:
admin/structure/domain/view/[current-domain:id]/config
On this page, I have edited the content type's menu settings, i.e. 'Basic page menu settings' and under the 'Basic page: Available menus' ticked the checkbox relevant to my subdomain.
I have also, under 'Menu Settings' on the same page, selected the relevant subdomain menu as the 'Source for the Main links' and 'Source for the Secondary links'.
Outcome
These actions have no effect and the problem remains as described above. Does anyone know of a solution? I have been working around the problem by noting down node numbers and manually adding them as links to the subdomain menus afterwards, but it seems to me that the settings above should work if I configure them properly? Any help would be very much appreciated.
Thanks Drupal community,
A~

Comments

agentrickard’s picture

Category: Support request » Bug report

Is that menu populated with items that are visible on the current domain?

Aptalops’s picture

hi @agentrickard, thanks for replying - yes each menu is populated with links that point to pages only available on the same domain.

Aptalops’s picture

Hi again, I think I have found some reasons for the behaviour described. What I think is happening is the following:

Each content type has its own 'Menu Settings' where the user can select the 'Available menus' for that particular content type:
http://www.example.com/?q=admin/structure/types/manage/[content-type]
I had left this as the default, i.e. my default domain's main menu was the available menu for my basic page content type (which explains the 'Problem' outlined above)

Any changes here override the settings on:
admin/structure/domain/view/[current-domain:id]/config
On this page, I edited the content type's menu settings, i.e. 'Basic page menu settings' and under the 'Basic page: Available menus' ticked the checkbox relevant to my subdomain.
I have also, under 'Menu Settings' on the same page, selected the relevant subdomain menu as the 'Source for the Main links' and 'Source for the Secondary links'.

I would have thought that perhaps on http://www.example.com/?q=admin/structure/types/manage/[content-type] there could be a way of specifying that the 'Available menu' could be the users 'Current menu' or the main menu specified for the active domain. Or maybe I'm missing something?

Anyway, knowing this goes some way to solving the problem, however it implies that one would have to set all domain menus as 'available menus' on the content type and having to update each time a new domain is created. Also, leaving all menus available on all domains when assigning a menu place on the content type makes it more likely that a user could accidentally drop the content into the wrong domain (I have nearly 100 domains and more menus!). Would anyone have any ideas on a way around this scenario?

p.s. thanks again for this amazing module...

Aptalops’s picture

Category: Bug report » Support request
agentrickard’s picture

New domains inherit settings from the default domain, until overridden by Domain Conf (or Domain Settings) modules.

Aptalops’s picture

Thanks @agentrickard for your reply. I wonder if you know of a way of 'restricting' the choice of menus available when a user creates content e.g. a new basic page, and wants to add that page to the menu (using the Menu settings > Provide a menu link option) so that perhaps he or she can only add the new page to their assigned domain? If this makes sense...
thank you
A~

agentrickard’s picture

I can't think of an easy solution, but it is possible.

You'd have to use a form_alter to target the Menu field and filter that list by the user's assigned domains. For non-admins, however, that list should already be filtered to "things that are visible on the current domain", and that is usually enough.

Aptalops’s picture

Thanks @agentrickard - I think you've identified the problem. I don't seem to have this filter to only show menus "that are visible on the current domain". Altering the menu settings on the domain, to 'set a source for the main links' has no effect. Even setting a default menu for a content type on the domain settings makes no change. I wonder what I'm missing?
Unfortunately, using a form_alter is beyond my coding skills at the moment. Although I did find the code below on stackoverflow (which I haven't tried yet). Is this the kind of thing you were suggesting? Can it be added as is or do I need to make any edits, to e.g. 'MYMODULE' (as I said, coding is not my thing - yet! Willing to learn...):

function MYMODULE_form_page_node_form_alter(&$form, &$form_state) {
  global $_domain;
  if (isset($_domain['domain_id'])) { // only display domain's primary links
    $menus[domain_conf_variable_get($_domain['domain_id'], 'menu_main_links_source')] = $_domain['sitename'].' Main menu';
  }
  if (isset($menus)) {
    $options = menu_parent_options($menus, $form['#node']->type);
    $form['menu']['link']['parent']['#options'] = $options;
  }
}

thanks again,
A~

Aptalops’s picture

Edited previous post to add code snippet.

bluegeek9’s picture

Component: - Domain Settings » Code
Status: Active » Closed (outdated)

Drupal 7 in End of Life and no longer supported. We encourage you to upgrade to a supported version of Drupal. For more information, see https://www.drupal.org/upgrade.

//www.flaticon.com/free-icons/thank-you Thank you for your contribution! Your continued support of this project makes other volunteer contributions more sustainable.
There are multiple ways to show appreciation for the work contributed to this project, including:
  • Triaging issues and adding more context to existing issues.
  • Writing documentation or patches for this project.