function hansel_og_action_add_og_path_config_form in Hansel breadcrumbs 7
Same name and namespace in other branches
- 8 og/hansel_og.module \hansel_og_action_add_og_path_config_form()
Callback to generate the configuration form for the "add og path" action
Parameters
array $arguments:
Return value
array
1 string reference to 'hansel_og_action_add_og_path_config_form'
- hansel_og_hansel_action_types in og/
hansel_og.module - Implements hook_hansel_action_types().
File
- og/
hansel_og.module, line 82 - Hansel organic groups integration
Code
function hansel_og_action_add_og_path_config_form($arguments) {
$form = array();
$options = array();
foreach (node_type_get_types() as $name => $type) {
$type_url_str = str_replace('_', '-', $type->type);
$usage = variable_get('og_content_type_usage_' . $type->type, 'omitted');
if ($usage == 'group') {
$options[$name] = drupal_ucfirst($type->name);
}
}
$form['group'] = array(
'#type' => 'checkboxes',
'#title' => t('Organic group'),
'#options' => $options,
'#description' => t('Use only for these groups. This only applies when this is a group type.'),
'#default_value' => isset($arguments['group']) ? $arguments['group'] : array(),
'#required' => TRUE,
'#attributes' => array(
'class' => 'hansel-og-checkboxes',
),
);
// Add configurable paths per type
foreach ($options as $key => $option) {
$form['path_' . $key] = array(
'#type' => 'textfield',
'#title' => t($option . ' path'),
'#description' => t('Provide a path to link to in the breadcrumb'),
'#default_value' => isset($arguments['path_' . $key]) ? $arguments['path_' . $key] : 'og',
'#attributes' => array(
'class' => 'og-hansel-path og-hansel-path-' . $key,
'display' => 'none',
),
);
}
$form['type'] = array(
'#type' => 'checkbox',
'#title' => t('Show type of group in breadcrumb'),
'#description' => t('Select this if you want to dipslay the type of group in the breadcrumb.'),
'#default_value' => isset($arguments['type']) ? $arguments['type'] : 0,
'#attributes' => array(
'class' => 'og-hansel-type',
),
);
return $form;
}