You are here

farm_map_mapbox.module in farmOS 7

Farm map Mapbox.

File

modules/farm/farm_map/farm_map_mapbox/farm_map_mapbox.module
View source
<?php

/**
 * @file
 * Farm map Mapbox.
 */

/**
 * Implements hook_farm_info().
 */
function farm_map_mapbox_farm_info() {
  $info = array();

  // Add the Mapbox API key to /farm.json.
  $api_key = variable_get('farm_map_mapbox_api_key', '');
  if (!empty($api_key)) {
    $info['mapbox_api_key'] = $api_key;
  }
  return $info;
}

/**
 * Implements hook_form_FORM_ID_alter().
 */
function farm_map_mapbox_form_farm_map_settings_form_alter(&$form, &$form_state, $form_id) {

  // Add a field for setting the Mapbox API key in the farm_map settings form.
  $form['farm_map_mapbox_api_key'] = array(
    '#type' => 'textfield',
    '#title' => t('Mapbox API Key'),
    '#description' => t('Enter your Mapbox API key.'),
    '#default_value' => variable_get('farm_map_mapbox_api_key', ''),
  );
}