function domain_form_devel_generate_content_form_alter in Domain Access 7.2
Same name and namespace in other branches
- 6.2 domain.module \domain_form_devel_generate_content_form_alter()
- 7.3 domain.module \domain_form_devel_generate_content_form_alter()
Add settings to devel generate module.
File
- ./
domain.module, line 2218 - Core module functions for the Domain Access suite.
Code
function domain_form_devel_generate_content_form_alter(&$form, &$form_state) {
$form['submit']['#weight'] = 10;
$form['domain'] = array(
'#type' => 'fieldset',
'#title' => t('Domain Access Options'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#weight' => 9,
);
$form['domain']['domain_site'] = array(
'#type' => 'select',
'#title' => t('Send to all affiliates'),
'#options' => array(
'none' => t('Never'),
'all' => t('Always'),
'random' => t('Randomly decide'),
),
'#description' => t('If you choose "always" or "randomly" you must select at least one domain below.'),
);
// Get the display format of the form element.
$format = domain_select_format();
foreach (domain_domains() as $data) {
// Cannot pass zero in checkboxes.
$data['domain_id'] == 0 ? $key = -1 : ($key = $data['domain_id']);
// The domain must be valid.
if ($data['valid'] || user_access('access inactive domains')) {
// Checkboxes must be filtered, select lists should not.
$options[$key] = empty($format) ? check_plain($data['sitename']) : $data['sitename'];
}
}
$form['domain']['domains'] = array(
'#type' => empty($format) ? 'checkboxes' : 'select',
'#title' => t('Publish to'),
'#options' => $options,
'#description' => t('Generated content will be accessible on any or all of the domains checked above.'),
);
if ($format) {
$form['domain']['domains']['#multiple'] = TRUE;
$form['domain']['domains']['#size'] = count($options) > 10 ? 10 : count($options);
}
}