You are here

function location_extra_form in Location 5

1 string reference to 'location_extra_form'
location_nodeapi in ./location.module
Implementation of hook_nodeapi().

File

./location.module, line 1106

Code

function location_extra_form(&$node) {
  $location_fields = array();
  $required_fields = array();
  foreach (array_keys(location_field_names()) as $field_name) {
    $workflow_setting = variable_get('location_' . $field_name . '_' . $node->type, $field_name == 'country' ? 1 : 0);
    if ($workflow_setting) {
      $location_fields[] = $field_name;
      if ($workflow_setting == 2) {
        $required_fields[] = $field_name;
      }
    }
  }
  $suppressed_values = variable_get('location_suppress_country', 0) ? array(
    'country' => variable_get('location_default_country', 'us'),
  ) : array();
  $form['location'] = array(
    '#type' => 'fieldset',
    '#title' => t('Add another location'),
    '#tree' => TRUE,
    '#attributes' => array(
      'class' => 'location',
    ),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['location'] = array_merge($form['location'], location_form($location_fields, array(
    'country' => variable_get('location_default_country', 'us'),
  ), array(), $suppressed_values));
  if (user_access('submit latitude/longitude')) {
    $form['location'][] = array(
      '#type' => 'markup',
      '#value' => "<br/>\n",
    );
    $form['location'] = array_merge($form['location'], location_latlon_form(t('If you wish to supply your own latitude/longitude, you may do so here.  Leaving these fields blank means that the system will determine a latitude/longitude for you, if possible.'), array()));
  }
  $form['location']['nid'] = array(
    '#type' => 'hidden',
    '#value' => $node->nid,
  );

  //================================================
  $form['location']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Add location'),
  );
  return $form;
}