You are here

function getlocations_leaflet_plugin_style::option_definition in Get Locations 7

Same name and namespace in other branches
  1. 7.2 modules/getlocations_leaflet/views/getlocations_leaflet_plugin_style.inc \getlocations_leaflet_plugin_style::option_definition()

Information about options for all kinds of purposes will be held here.

@code 'option_name' => array(

  • 'default' => default value,
  • 'translatable' => (optional) TRUE/FALSE (wrap in t() on export if true),
  • 'contains' => (optional) array of items this contains, with its own defaults, etc. If contains is set, the default will be ignored and assumed to be array().
  • 'bool' => (optional) TRUE/FALSE Is the value a boolean value. This will change the export format to TRUE/FALSE instead of 1/0.
  • 'export' => (optional) FALSE or a callback for special export handling if necessary.
  • 'unpack_translatable' => (optional) callback for special handling for translating data within the option, if necessary.

),

Return value

array Returns the options of this handler/plugin.

Overrides views_plugin_style::option_definition

See also

views_object::export_option()

views_object::export_option_always()

views_object::unpack_translatable()

File

modules/getlocations_leaflet/views/getlocations_leaflet_plugin_style.inc, line 37
getlocations_leaflet_plugin_style.inc @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Class

getlocations_leaflet_plugin_style
@file getlocations_leaflet_plugin_style.inc @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function option_definition() {
  $options = parent::option_definition();
  $getlocations_leaflet_defaults = getlocations_leaflet_defaults();

  // fallback
  $getlocations_defaults = getlocations_defaults();
  foreach ($getlocations_leaflet_defaults as $key => $value) {
    $options[$key] = array(
      'default' => $value,
    );
  }
  $options['map_resize'] = array(
    'default' => 0,
  );
  $options['fullscreen_disable'] = array(
    'default' => 0,
  );
  $options['styles'] = array(
    'default' => '',
  );
  $options['jquery_colorpicker_enabled'] = array(
    'default' => 0,
  );

  // node markers
  $getlocations_node_marker = variable_get('getlocations_node_marker', array(
    'enable' => 0,
  ));
  if ($getlocations_node_marker['enable']) {
    if ($types = getlocations_get_types()) {
      foreach ($types as $type => $name) {
        $field_names = getlocations_get_fieldname2($type, 'node');
        foreach ($field_names as $field_name) {
          $mkey = 'node_marker__' . drupal_strtolower($type) . '__' . $field_name;
          $mmarker = isset($getlocations_node_marker['content_type'][$type]['field_name'][$field_name]['map_marker']) ? $getlocations_node_marker['content_type'][$type]['field_name'][$field_name]['map_marker'] : $getlocations_defaults['node_map_marker'];
          $options[$mkey] = array(
            'default' => $mmarker,
          );
        }
      }
    }
  }
  if (module_exists('taxonomy')) {

    // vocabulary markers
    if ($types = getlocations_get_vocabularies()) {
      $getlocations_vocabulary_marker = variable_get('getlocations_vocabulary_marker', array(
        'enable' => 0,
      ));
      if ($getlocations_vocabulary_marker['enable']) {
        foreach ($types as $type => $name) {
          $field_name = getlocations_get_fieldname($type, 'taxonomy_term');
          $mkey = 'vocabulary_marker_' . $field_name;
          $mmarker = isset($getlocations_vocabulary_marker['vocabulary'][$type]['map_marker']) ? $getlocations_vocabulary_marker['vocabulary'][$type]['map_marker'] : $getlocations_defaults['vocabulary_map_marker'];
          $options[$mkey] = array(
            'default' => $mmarker,
          );
        }
      }
    }

    // term markers
    $getlocations_term_marker = variable_get('getlocations_term_marker', array(
      'enable' => 0,
      'vids' => 0,
      'max_depth' => '',
    ));
    if ($getlocations_term_marker['enable'] && $getlocations_term_marker['vids']) {
      $depth = is_numeric($getlocations_term_marker['max_depth']) && $getlocations_term_marker['max_depth'] > 0 ? $getlocations_term_marker['max_depth'] : NULL;
      $vids = $getlocations_term_marker['vids'];
      foreach ($vids as $vid) {
        $terms = taxonomy_get_tree($vid, 0, $depth);
        foreach ($terms as $term) {
          $tid = $term->tid;
          $mkey = 'term_marker_' . $tid;
          $mmarker = isset($getlocations_term_marker['vid'][$vid]['term'][$tid]['map_marker']) ? $getlocations_term_marker['vid'][$vid]['term'][$tid]['map_marker'] : $getlocations_defaults['term_map_marker'];
          $options[$mkey] = array(
            'default' => $mmarker,
          );
        }
      }
    }
  }

  // empty_result
  $options['empty_result'] = array(
    'default' => FALSE,
  );
  return $options;
}