You are here

function openlayers_cck_field_settings in Openlayers 6.2

Same name and namespace in other branches
  1. 6 modules/openlayers_cck/openlayers_cck.module \openlayers_cck_field_settings()

Implementation of hook_field_settings().

File

modules/openlayers_cck/openlayers_cck.module, line 137
This file holds the main Drupal hook functions and private functions for the openlayers_cck module.

Code

function openlayers_cck_field_settings($op, $field) {
  switch ($op) {
    case 'form':
      $form = array();
      $features = array(
        'point' => t('Point'),
        'path' => t('Path'),
        'polygon' => t('Polygon'),
      );

      // What type of features to accept
      $form['openlayers_cck_feature_types'] = array(
        '#type' => 'checkboxes',
        '#title' => t('Feature Types'),
        '#description' => t('Choose the features that are allowed to ' . 'be input on the map.'),
        '#options' => $features,
        '#required' => TRUE,
        '#default_value' => is_array($field['openlayers_cck_feature_types']) ? $field['openlayers_cck_feature_types'] : array(
          'point',
          'path',
          'polygon',
        ),
      );
      return $form;
    case 'validate':
      break;
    case 'save':
      return array(
        'openlayers_cck_feature_types',
      );
    case 'database columns':
      $columns = array(
        'openlayers_wkt' => array(
          'type' => 'text',
          'size' => 'big',
          'not null' => FALSE,
          'sortable' => TRUE,
          'views' => TRUE,
        ),
      );
      return $columns;
    case 'views data':
      $data = content_views_field_views_data($field);
      $db_info = content_database_info($field);
      $table_alias = content_views_tablename($field);
      return $data;
  }
}