4 * Implements hook_schema().
6 function mapboxjs_schema() {
8 // MapBox.js map preset table.
9 $schema['mapboxjs_preset'] = array(
10 'description' => 'MapBox.js map presets',
12 'mapboxjs_preset_id' => array(
15 'description' => 'Primary Key: Unique Mapbox.js preset entity ID.',
18 'description' => 'The machine-readable name of this mapboxjs_preset type.',
24 'description' => 'The human-readable name of this mapboxjs_preset type.',
30 'description' => 'MapBox JS map settings as a serialized array.',
37 'description' => 'The Unix timestamp when the mapboxjs_preset was created.',
43 'description' => 'The Unix timestamp when the mapboxjs_preset was most recently saved.',
48 // following fields are for supporting exportable status.
50 'description' => 'A boolean indicating whether the administrator may delete this preset.',
59 // Set the default to ENTITY_CUSTOM without using the constant as it is
60 // not safe to use it at this point.
63 'description' => 'The exportable status of the entity.',
66 'description' => 'The name of the providing module if the entity has been defined in code.',
72 'primary key' => array('mapboxjs_preset_id'),
73 'unique keys' => array(
74 'name' => array('name'),
82 * Implements hook_install()
84 function mapboxjs_install() {
85 // Add a locked Link field to our MapBox.js custom entity bundle.
86 // Provides storage for our base tileset(s).
87 $base_tilesets_config = array(
88 'translatable' => '0',
89 'entity_types' => array(),
91 'attributes' => array(
92 'target' => 'default',
97 'title' => 'required',
99 'title_maxlength' => 128,
100 'enable_tokens' => 1,
105 'foreign keys' => array(),
106 'indexes' => array(),
107 'field_name' => 'field_base_tilesets',
108 'type' => 'link_field',
112 'cardinality' => '-1',
115 $base_tilesets_instance = array(
116 'label' => 'Base tileset(s)',
119 'type' => 'link_field',
122 'settings' => array(),
127 'title' => 'required',
129 'title_maxlength' => '128',
130 'enable_tokens' => 1,
132 'url_cutoff' => '80',
134 'attributes' => array(
135 'target' => 'default',
138 'configurable_title' => 0,
141 'user_register_form' => FALSE
,
148 'settings' => array(),
152 'description' => 'Please enter the full URL of a <a href="http://mapbox.com">MapBox</a> tileset to be added to this map as a base layer. This URL should be in the TileJSON file format, like http://a.tiles.mapbox.com/v3/tmcw.map-hehqnmda.jsonp. The "title" you enter for this URL will be used in the map\'s tile switcher.',
153 'default_value' => NULL
,
154 'field_name' => 'field_base_tilesets',
155 'entity_type' => 'mapboxjs_preset',
156 'bundle' => 'mapboxjs_preset',
159 field_create_field($base_tilesets_config);
160 field_create_instance($base_tilesets_instance);
161 // Add a locked Link field to our MapBox.js custom entity bundle.
162 // Provides storage for optional tilesets place on top of base tileset(s).
163 $optional_tilesets_config = array(
164 'translatable' => '0',
165 'entity_types' => array(),
167 'attributes' => array(
168 'target' => 'default',
173 'title' => 'required',
175 'title_maxlength' => 128,
176 'enable_tokens' => 1,
181 'foreign keys' => array(),
182 'indexes' => array(),
183 'field_name' => 'field_optional_tilesets',
184 'type' => 'link_field',
188 'cardinality' => '-1',
191 $optional_tilesets_instance = array(
192 'label' => 'Optional tileset(s)',
195 'type' => 'link_field',
198 'settings' => array(),
203 'title' => 'required',
205 'title_maxlength' => '128',
206 'enable_tokens' => 1,
208 'url_cutoff' => '80',
210 'attributes' => array(
211 'target' => 'default',
214 'configurable_title' => 0,
217 'user_register_form' => FALSE
,
224 'settings' => array(),
228 'description' => 'Please enter the full URL of a <a href="http://mapbox.com">MapBox</a> tileset to be added to this map on top of the base tileset layers. This URL should be in the TileJSON file format, like http://a.tiles.mapbox.com/v3/tmcw.map-hehqnmda.jsonp. The "title" you enter for this URL will be used in the map\'s toggle controls for optional tileset layers, if the controls are enabled.',
229 'default_value' => NULL
,
230 'field_name' => 'field_optional_tilesets',
231 'entity_type' => 'mapboxjs_preset',
232 'bundle' => 'mapboxjs_preset',
235 field_create_field($optional_tilesets_config);
236 field_create_instance($optional_tilesets_instance);
240 * Implements hook_field_schema().
242 function mapboxjs_field_schema($field) {
251 'columns' => $columns,
256 * Implements hook_uninstall().
258 function mapboxjs_uninstall() {
259 // Delete locked fields when uninstalling module.
260 field_delete_instance('field_base_tilesets', TRUE
);
261 field_delete_instance('field_optional_tilesets', TRUE
);