Posted by jeremyr on September 14, 2009 at 1:05am
| Project: | Domain Access |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Is it possible to change the way the available "Publish To" domains list on the create and edit node pages?
A select box or some other way to compact the list when it reaches a certain number would be helpful. I don't know if it would help anyone else, with 100+ domain names like me.
Thanks for considering.
Comments
#1
There should already be another issue originally started from #367752: Domain Content: too many menu items that deals with the same problem but I cannot find it atm. 100+ domains is not that unusual.
#2
Right now, you can implement this quickly with hook_form_alter(). We need ideas for the best way to generically handle this.
I don't think we ever started a new issue, so we can use this one. Simple first idea:
-- It would be easy to make the list configurable in the UI.
#3
Configurable in the UI would be nice... if you meant that we could switch between the different ways for displaying them. An option to show the domains "collapsed by default" would be nice too.
I'm still very new at module development but would like to help where I can. Testing would be the thing I could do with out messing up anything.
#4
drop down please. subscribing
#5
Here's a patch that lets the site admin choose the format. The variable setting defaults to checkboxes, but switches to select list if more than 25 domains are present.
You can also force the format you prefer. This change applies globally to all form element in the core DA suite.
For developers, see the new
domain_select_format()function and form elements like the options form in Domain Views > domain_views_access_plugin.inc.<?phpfunction options_form(&$form, &$form_state) {
$domains = domain_domains();
$options = array();
$format = domain_select_format();
foreach ($domains as $domain) {
// Checkboxes cannot handles zeros.
if ($domain['domain_id'] == 0) {
$domain['domain_id'] = -1;
}
// The domain must be valid.
if ($domain['valid'] || user_access('administer domains')) {
// Filter checkboxes but not select lists.
$options[$domain['domain_id']] = empty($format) ? check_plain($domain['sitename']) : $domain['sitename'];
}
}
$form['domains'] = array(
'#type' => empty($format) ? 'checkboxes' : 'select',
'#multiple' => TRUE,
'#options' => $options,
'#title' => t('Domains'),
'#default_value' => $this->options['domains'],
'#description' => t('Only users with the selected permission flag will be able to access this display. Note that users with "access all views" can see any view, regardless of other permissions.'),
);
if ($format) {
$form['domains']['#multiple'] = TRUE;
$form['domains']['#size'] = count($options) > 10 ? 10 : count($options);
}
}
?>
#6
Updated patch. Committed.
#7
D5 is dead.