-
Notifications
You must be signed in to change notification settings - Fork 15
Drupal Data Store Sync
For clients who use Gigya's Data Store (DS), synchronization between Drupal and the Data Store is available by activating a separate module on top of the main Gigya Extension for Drupal.
The DS Sync module pulls user data from Gigya's Data Store and maps it into the user account database in Drupal.
To implement DC sync, follow these steps:
1.Update Drupal | 2.Enable Gigya DS | 3.Configure DS Settings |
---|
Open https://www.drupal.org/project/gigyaInformation published on non-SAP site, download the most recent release for Drupal version 8 (v. 8.x.-1.5.01 and up), and install it.
In Drupal, in the modules configuration section, check the checkbox for Gigya - Customer Identity Management - DS.
There are two configurable options in the DS sync module:
-
Data extraction method - the default is to use "get" (see explanation below). You can leave the default or change it to "search".
-
Field mapping - you must define which DS fields are mapped to which Drupal fields. See below.
Both these configurations are done in a YAML file in JSON format. To configure, you first export the existing configurations, then edit them and import back the file of the same name:
-
In Drupal, go to Administration > Configuration > Development > Synchronize.
-
Click Export.
-
Under Configuration type, select "Simple configuration".
-
Under Configuration name, select "gigya_ds_settings".
The configuration appears in the configuration window. The relevant parameters are:
-
gigya_ds_mapping - defines the field mapping
-
gigya_ds_use_search - defines the data extraction method.
-
-
After editing the file, select the Import tab to write your changes to the database.
You can choose between the ds.search and ds.get data extraction method. The default is ds.get. The ds.get method may be used if only one OID is being passed. Our recommendation is as follows:
-
If you are passing one OID, use ds.get.
-
If you are sending multiple OIDs or sending multiple queries to the DS database, use search.
To change the configuration from get to search, in the configuration file, change the value of the gigya_ds_use_search parameter to "true":
gigya_ds_use_search: true
The matching of a DS field to a Drupal one is done in JSON format. Each mapping of one Gigya field to one Drupal field is an object, and the entire field mapping definition is an array of mapping objects. Prepare your field mapping, and then import it into Drupal as described below.
Define your field mapping in the gigya_ds_mapping parameter according to the following guidelines:
Example: The following file maps the ds.test.data field from Gigya DS to a field called field_custom2 in Drupal:
[
{
"cmsName": "field_custom2",
"cmsType": "string",
"gigyaName": "ds.test.data", // In this example, "test" is the name of the table defined in DS, and "data" is the name of the field
"gigyaType": "string",
"custom": {
"oid": "segments"
}
}
]
For each mapping (each object in the array), the following parameters apply:
Required | Key | Description |
---|---|---|
cmsName | The name of the field in Drupal. This should be identical to the Machine name of the field listed under Drupal Configuration > Manage fields. This name usually starts with 'field'. | |
cmsType | The type of the Drupal field. Accepted values are integer, string, date or boolean. | |
gigyaName | Field in Gigya DS in the following format: ds.. , where ds is fixed, and the type (table) and field name should be specified (case sensitive). Note: If the field was assigned a suffix in the Gigya DS, according to the field type (e.g., _i to denote an integer field), you should also add the suffix to the gigyaName field mapping. |
|
gigyaType | The type of the Gigya field. | |
custom | An array in which to specify the Data Store oid parameter. |
Note:
After changing a configuration, we recommend you clear the browser cache to ensure changes go into effect. In Drupal, you can clear the cache by opening Configuration > Performance and selecting Clear the cache.
You can manually fetch data from the Data Store. You can also listen to specified events using a hook, and transform DS data as needed.
You can download our sample "Gigya Client" moduleInformation published on non-SAP site, and install according to Drupal's documentation. For example, gigya_client_fetch_ds_data_only is a demo function that demonstrates how to fetch data from Gigya's Data Store; and the gigya_client_gigya_ds_data_alter hook maps the data of the "abc" array to the "d" field (e.g. when converting 3 fields that denote day, month and year, to one date field).
Tip
Review the code and use the module as a reference for your own hook implementations.
Name | Parameters | Description |
---|---|---|
gigya_client_fetch_ds_data_only | Function that fetches DS data for the current UID. | |
gigya_client_gigya_ds_data_alter | $ds_data | Hook that enables changing the DS data array. |