function location_addanother_form in Location 7.3
Same name and namespace in other branches
- 5.3 contrib/location_addanother/location_addanother.module \location_addanother_form()
- 6.3 contrib/location_addanother/location_addanother.module \location_addanother_form()
- 7.5 contrib/location_addanother/location_addanother.module \location_addanother_form()
- 7.4 contrib/location_addanother/location_addanother.module \location_addanother_form()
Form to display directly on a node view for "quick location add" functionality.
1 string reference to 'location_addanother_form'
- location_addanother_node_view in contrib/
location_addanother/ location_addanother.module - Implements hook_node_view().
File
- contrib/
location_addanother/ location_addanother.module, line 58 - "Add location from node view" functionality. Split from main location.module in version 3.
Code
function location_addanother_form($form, &$form_state, $node) {
// Load the content type's location settings to set the form's default settings.
$settings = variable_get('location_settings_node_' . $node->type, array());
// Store the node in form_state so it doesn't have to get loaded more than once.
$form_state['#node'] = $node;
$form['location'] = array(
'#type' => 'location_element',
'#title' => t('Add another location'),
'#default_value' => NULL,
'#location_settings' => $settings,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Add location'),
'#weight' => 50,
);
return $form;
}