Background
Thanks for this wonderful module. I should say that this issue has evolved from a previous entry. The title of the original post doesn't correspond with my current issue, so I'm creating a new one here.
(if you're interested, I'm referring to this issue).

Issue
I wonder if anyone knows of a way to 'restrict' the choice of menus available when an administrator of a sub-domain (i.e. a Domain Access module 'domain') creates content, such as a new basic page, and wants to add that page to the menu (using the Menu settings > Provide a menu link option) so that he or she can only add the new page to their assigned domain? If this makes sense...

Steps tried so far
I've tried altering the menu settings on each domain (I have approx 100 domains), to 'set a source for the main links' but this has no effect. I wonder what I'm missing? My problem is that with around 100 domains worldwide and over 100 administrators each managing their own domain, it is currently too easy to accidentally add a new piece of content to the wrong menu (using the Menu settings > Provide a menu link option). It would be great if there was option to set the default selected menu to e.g. the user's assigned domain. Perhaps this functionality already exists and I'm just not seeing it.

A suggestion and possible solution, but don't know how to apply it
@agentrickard has suggested a using a form_alter. I'm afraid this is beyond my coding skills at the moment. However, I did find the code below on stackoverflow (which I haven't tried yet). I wonder if this is this the kind of thing you were suggesting when referring to a 'form_alter'?
Can it be added as it is below or do I need to make any edits, to e.g. 'MYMODULE' (as I said, coding is not my thing - yet! Willing to learn but currently afraid of somehow corrupting my site or db):

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~

Comments

web506’s picture

Have you checked the Domain Menu Access Module?

https://www.drupal.org/project/domain_menu_access

Aptalops’s picture

Thanks for the suggestion @web506 - I read through the documentation carefully and although it sounds like a useful module, I don't think it would solve my particular problem. The Domain Menu Access Module seems to be useful when there's a need to screen individual menu items, rather than entire menus, and anyway all of this is ignored in the administration area. Also, some users report that it doesn't play well with Superfish - although I can't confirm this myself. Thanks again though, I hadn't spotted this module.
A~

Aptalops’s picture

Issue summary: View changes

just clarified issue by changing:

an administrator

to:

an administrator of a sub-domain (i.e. a Domain Access module 'domain')

eMuse_be’s picture

Did you solve this? I am looking for the same thing

rundleromanowicz’s picture

Did anyone ever find a solution for this? I'm trying to figure out the same, but on D8.

bluegeek9’s picture

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.