Download & Extend

Menu Settings per Content Type with Domain Access

Project:Menu Settings per Content Type
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Issue tags:CTM, domain access

Issue Summary

I work with a site that use the Domain Access (DA) module. I love your
module, and I have written a module so that it works with DA (I haven't put
it up yet).

However, it will only work correctly with a small change to the code for
CTM:

// Menu Settings for Node Edit (Form)
elseif (isset($form['#node']) && $form['#node']->type .'_node_form' ==
$form_id) {
$menu_settings = variable_get($form['#node']->type.'_menu_settings',
array());

//THIS IS THE EXTRA LINE - ISN'T IT ANYWAY A GOOD IDEA TO FILTER BEFORE
THE ARRAY_INTERSECT() BELOW?
$menu_settings = array_filter($menu_settings);

if ($menu_settings) {
$menus = array_intersect_key(menu_get_menus(), $menu_settings);
$options = menu_parent_options($menus, $form['menu']['#item']);
$form['menu']['parent']['#options'] = $options;
} else {
unset($form['menu']);
}
}

Below is my code for a Domain CTM-module:

/**
* @file
* Multi domain support for Menu Settings per Content Type (CTM).
*/

/**
* implementation of hook_domainconf()
*
*/
function ctm_domainconf($domain) {

$node_types = node_get_types('names');
$options = menu_get_menus();

$form['ctm_conf'] = array(
'#type' => 'fieldset',
'#title' => t('Menu Settings per Content Type (CTM) settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => 10
);

foreach ($node_types as $key => $value) {
$default_values = variable_get($key.'_menu_settings', array());

$form['ctm_conf'][$key.'_menu_settings'] = array(
'#type' => 'checkboxes',
'#title' => t('Menu settings for <strong>'. $key.'</strong>'),
'#options' => $options,
'#default_value' => $default_values,
);

}

return $form;
}

If you'll consider the change to the code, I could use the module straight
from the source without any modifications - AND I will be able to upgrade your
module without any problem, in case you make future versions.

Comments

#1

+1

PS. mind sharing that module....

#2

Alright got it installed, here's the module (credits to wiredloose)
Working great, thanx.

+1 for line of code to be implemented...

Cheers

AttachmentSize
ctm_domainconf.zip 988 bytes

#3

That's nice, thank you for sharing.
If I understand correctly, you would only need this module if you want to configure CTM differently for each domain, right? As far as I can see, CTM works together with DA perfectly, but you can only use global settings.

#4

+1

subscribing

#5

Version:6.x-1.0» 6.x-2.x-dev
Status:active» needs work

moved to the new branch

about the submodule posted:

  • rename to ctm_domain
  • rename the hook function according with submodule name : ctm_domain_domainconf

questions:

  • does it works? does it do its job?
  • should be a submodule or should be included in the ctm module?

#6

Hi Vasike,

See you have been answering many issues today, thanx for that!

As to your questions;

- Works great, have the module I posted as a zip file running on a production site for 2 years now!
- I believe a submodule included in CTM (so it can be enabled seperately) is best, not everyone uses domain access.

Cheers

nobody click here