gmap_cck_field_settings($op, $field)
gmap_addons/gmap_cck.module, line 90
Handle the parameters for a field.
$op The operation to be performed. Possible values:
This varies depending on the operation.
| Name | Description |
|---|---|
| Hooks | Allow modules to interact with the Drupal core. |
<?php
function gmap_cck_field_settings($op, $field) {
switch ($op) {
case 'form':
$def = array(
'maptype' => $field['maptype'],
'controltype' => $field['controltype'],
'width' => $field['width'],
'height' => $field['height'],
'latlong' => $field['latlong'],
);
$form = gmap_macro_builder_form($def);
$form['#title'] = t('Google Map settings');
// keep: mapdiv
unset($form['macroform']['overlayedit']);
unset($form['macroform']['mapid']);
// keep: maptype, controltype
unset($form['macroform']['address']);
//unset($form['macroform']['latlong']);
// keep: width, height, alignment, zoom
unset($form['macroform']['macro']);
// GPX file support
$gpx_opts = array(t('Disabled'));
if (module_exists('filefield')) $gpx_opts['filefield'] = t('CCK Filefield');
// TODO: attachment to node, uploaded file, url from user, ...
if (count($gpx_opts) > 1) {
$form['gpx'] = array(
'#type' => 'select',
'#title' => t("GPX File support"),
'#options' => array(
0 => t('Disabled'),
'filefield' => t('CCK Filefield'),
),
'#default_value' => $field['gpx'],
);
// if gpx-support is enabled we need a source for the data
$form['gpx_src'] = array(
'#type' => 'textfield',
'#title' => t('GPX data source parameter'),
'#description' => t('Only used if gpx-support is enabled'),
'#default_value' => $field['gpx_src'],
);
}
// noderef field(s) to nodes with locations for markers
if (module_exists('nodereference')) {
$form['marker_noderef'] = array(
'#type' => 'textfield',
'#title' => t('Marker noderef'),
'#description' => t('Name of noderef field to nodes to show as markers'),
'#default_value' => $field['marker_noderef']
);
}
return $form;
case 'validate': // check stuff entered in form-fields
break;
case 'save':
return array('maptype', 'controltype', 'width', 'height', 'alignment',
'zoom', 'latlong', 'gpx', 'gpx_src', 'marker_noderef');
case 'database columns':
$columns = array( // TODO: ??? type -> longtext ???
'value' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'default' => "''", 'sortable' => false),
);
return $columns;
case 'callbacks': // CHECK: ??? any effect on calling ..._field() ???
return array(
'view' => CONTENT_CALLBACK_CUSTOM,
);
}
}
?>