<?php

defined('_JEXEC') or die;

jimport( 'joomla.form.fields.text' );
JFormHelper::loadFieldClass('list');

if (!class_exists('MapBox')) {
    require_once JPATH_ROOT . '/modules/mod_mapbox/MapBox.php';
}

class JFormFieldGeoJson extends JFormFieldText {
    protected $mapbox;
    protected $type = 'GeoJson';
    protected $class = "geojson";

    public function __construct(Form $form = null)
    {
        parent::__construct($form);
        $this->mapbox = new MapBox(true);
    }

    protected function getInput()
    {
        return $this->mapbox->render($this->value, $this->name);
    }

    protected function getLabel()
    {
        return '';
    }
}
