Online Book Reader

Home Category

Mapping With Drupal - Alan Palazzolo [49]

By Root 527 0
Views, which also has good support for the Features module. In this section we will walk through the process of exporting your map configurations to Features.

NOTE

There are other ways to export configuration to code, such as CTools export, but the Features module is the simplest to use.

The first step is to set up the Features module and another module that helps with this process: the Strongarm module.

Download the latest stable release of the Features module and the Strongarm module to your site’s Modules directory.

Enable the Features module.

Configure the permissions for the Features module at admin/people/permissions#module-features. The administrator role should have permission for both “Administer features” and “Manage features.”

Exporting OpenLayers and Geofield with Features


In this chapter, names of various Modules, Fields, Content Types, etc., may be different from what you have in your site, and some things won’t be there if you did not complete all of the tutorials. This Feature will contain the configuration for the Content Types, Views, and Maps, Styles, etc., that we created to demonstrate OpenLayers and Geofield in earlier chapters. This was based around Drupal User Groups and Drupal Events.

From the Manage features page, create a new Feature at admin/structure/features/create.

In the “Name” field, enter User groups and events.

In the “Description” field, enter Configuration for user groups and events.

The “Version” and “URL of update XML” fields can be left blank, as they are only needed if you plan to distribute your Features beyond your own site.

The “Edit components” section of the form is the where you choose which of the available configurations you want to include in your Feature. It is easiest to start with the most important pieces of configuration. The Features module has a fairly sophisticated set of dependency-checking logic, so it will detect much of the other configuration for you.

In the “Edit components” drop-down, select “Content types: node.” In the list of content types, select “Event” and “User Group.” These are the two content types that were used in the tutorials for making maps with OpenLayers and Geofield. Notice how those two content types now show up in gray on the right and many other things in other sections will now suddenly show up in blue. These are the other parts of the configuration that Features will export to code without any further instruction on your part; this is the dependency checking.

In the “Edit components” drop-down, select “OpenLayers: openlayers_layers.” There is nothing listed here to add to our Feature, because all the layers were created in Views, which Features handles separately.

In the “Edit components” drop-down, select “OpenLayers: openlayers_maps.” In the list of maps, select “Drupal user groups.” This is the Map that was configured in OpenLayers Maps.

In the “Edit components” drop-down, select “OpenLayers: openlayers_styles.” In the list of styles, select “Drupal user groups.” This is the style that was configured in OpenLayers styles.

In the “Edit components” drop-down, select “Permissions: user_permission.” In the very long list of permissions, find any that relate to the modules that are part of this feature:

Node: Event: Create new content

Node: Event: Edit own content

Node: Event: Edit any content

Node: Event: Delete own content

Node: Event: Delete any content

Node: User Group: Create new content

Node: User Group: Edit own content

Node: User Group: Edit any content

Node: User Group: Delete own content

Node: User Group: Delete any content

OpenLayers UI: Administer OpenLayers

In the “Edit components” drop-down, select “Strongarm: variable.” In the very long list of variables, find any that relate to this feature:

openlayers_default_map

openlayers_source

In the “Edit components” drop-down, select “Views: views_view.” In the list of Views, select “Drupal groups,” “Map of Drupal groups,” and “Upcoming events.” These are the Views that

Return Main Page Previous Page Next Page

®Online Book Reader