Drupal v7
Last updated
Last updated
The source Drupal v7 connector allows content, user, files and folders to be picked up from a Drupal v7 system and transformed into motation.
To set up drupal 7 as a rest server for ImpulseSync to connect to there are a number of requirements to be met.
Apply this
Reference/Relationship required modules
Language required modules
Languages are a WIP, these are the modules/config currently used, but are subject to change.
After the required modules are installed, a number of modules must be enabled.
Chaos Tools Suite -> Chaos tools
Other -> Entity API
Other -> Entity tokens
Other -> Libraries
Services -> Services
Services -> Services Entity
Services -> Services Entity Reference
Services - Authentication -> Services basic authentication
Services - Servers -> REST Server
The REST API now needs to be created. Configure the services module.
Press “Add”.
Provide a name for the endpoint.
Select the REST Server.
Set the “Path to endpoint” as “api/1.0”
Set the HTTP basic authentication for Authentication.
Save.
Go to the Server tab.
Remove all response formatters except json.
Save.
Go to the Resources tab.
Allow access for entity_file, entity_node, entity_taxonomy_term, entity_taxonomy_vocabulary, entity_user, file, and node.
Save.
core -> locale
core -> Content translation
multilingual -> Localization update
multilingual - Entity Translation -> Entity Translation
multilingual - Entity Translation -> Entity Translation Upgrade
multilingual - Internationalization -> Block languages
multilingual - Internationalization -> Field translation
multilingual - Internationalization -> Multilingual content
Variable -> Variable
When saving an endpoint for a Drupal v7 repository via REST instead of the UI you must use the following key:value pairs in the payload.
contentRepo:drupal
contentRepoVersion:v7
Most fields are of type String, Array, File, or Relationship.
We highly recommend mapping all fields from Drupal v7 due to this field type limitation and not relying on ImpulseSync's auto mapping.
The connector will attempt to transform all attributes from the rest API for any content picked up from the Drupal system. Some fields have multiple attributes within the field, while some attributes are not standard drupal fields. Below are the documented rules for naming convention and the expected value of the field.
For a standard Drupal field:
If the field has an inner attribute value
this will be the "default" value of the field. This field id will match the field machine name of the field in Motation.
If the field has an inner attribute fid
this will be the "default" value of the field. This field id will match the field machine name of the field in Motation. The field type will File
If the field has an inner attribute tid
this will be the "default" value of the field. This field id will match the field machine name of the field in Motation. The field type will Tag
If the field has an inner attribute target_id
this will be a separate field with ID field_machine_name_target_id. This is different from the default field_machine_name field. The default field will be the relationship field to be used and mapped as usual. This separate field will be have the value of the target_id (usually a string value).
All other inner attributes will have the field ID field_machine_name_inner_attribute.
The value of a field will be the value of the inner attribute.
If the inner attribute's value is a json object (or array) the value will be marshaled into a string field and the value will be the JSON object (or array) as a string.
For other attributes in the rest API response:
The field ID will be the name of the attribute.
The value will be the value of the attribute.
If the value is another JSON object (or array) the value will be marshaled into a string field and the value will be the JSON object (or array) as a string.
The field "type" for assets and users will be replaced with IMPULSE_ASSET and IMPULSE_USER respectively
Due to limitations of the rest API provided by the modules, the connector must manually filter out files that are in a child folder, rather than the current folder. This can cause picking up files to take longer than expected for a transaction that is picking up files with many files in child folders.
Contents in drupal have a reference to their related user with the key name
which is set as a relationship field in Motation. This field is specially created with the field id/unique name impulse_user_reference
. This is the value to use to access it's value via manipulators or mappings.
Rest APIs other than listed above.
Comments are unsupported.
username
The username for authentication
password
The password for authentication
url
The URL the system's REST APIs are located at. i.e,. http://example.com
rateLimitPerSecond (optional)
The rate limit requests should be sent to the Drupal system. (default: 10)
contentType
The content type to pick up.
Text
true
folder
The folder path to pick up files from.
Text
false
No Default Value
query
Query params to add to the rest call to pick up content IDs with.
Text
false
No Default Value
UserChangedParam
Determines if the user object returns the "changed" attribute in API requests.
Boolean
false
true
additionalParams
Additional parameters to add to the REST request to the system. i.e., if a module is enabled that requires a "token" parameter for every request to the system.
Text
false
No Default Value
keepFileAttribute
Determines if an asset content should keep the file
attribute.
Boolean
false
false
recursiveFolder
Determines if assets in child/nested folders should be picked up.
Boolean
false
false
maxFolderDepth
Determines how many levels of child/nested folders to pickup assets for.
Integer
false
0 (no depth limit)
excludeFolder
Regex pattern for excluding folders from pickup.
Text
false
No Default Value
alternatePathAttribute
Determines if the "path" field should be retrieved/replaced with the value from the node
REST endpoint, rather than entity_node
endpoint.
Boolean
false
false
The content type job option is the content type to pick up.
The keyword IMPULSE_ASSET can be used in the contentType job option to pick up files.
The keyword IMPULSE_USER can be used in the contentType job option to pick up users as a content.
This option is paired with the IMPULSE_ASSET content type to limit the files picked up to a specific folder.
The folder job option is the folder to pick up files from. The folder path provided should be the full path from the root.
The folder option uses the uri
attribute from the Drupal 7 system to check if the folder exists. There are times when the uri
attribute includes additional prepended /
characters. i.e., public:////2023-10/inner-folder
. These assets that have a URI with additional prepended /
will be picked up for migration as well.
The value should be formatted as query parameters to be added to the rest call made to the system to query for contents. i.e., parameter[title]=info&options[parameters_op][title]=CONTAINS
parameters_op
values can be any of the following:
=
<>
>
>=
<
<=
STARTS_WITH
CONTAINS
IN
NOT IN
BETWEEN
LIKE
The max folder depth is used in conjunction with the recursiveFolder
option. This determines the depth of nested folders to pickup assets for.
Any value > 0 will determine the depth of nested folders to pick up assets from.
Any value <= 0 is equivalent to having no folder depth. Meaning all assets in nested folders will be picked up.
The exclude folder option is a regex pattern that when it matches will exclude that nested folder.
This pattern is run against the value of the nested folder paths.
i.e.,
If the full folder path is:
And the folder job option is:
The nested folder path that the regex pattern will be run on is:
Thus be sure to write your regex pattern appropriately.
Category
No
Definition
Yes
Domain
No
Folder
Yes
Language
Yes
Relationship
Yes
Tag
Yes
Field types may not always be as expected. This is due to the limitations of the system and modules in the data returned via the APIs. Check for what the Motation field type is for a field.
Entity Reference field (from module) with non node target type. i.e., user, taxonomy, file, comment. Only entity reference to node is supported.
View doc and this for additional details.
The value set is query parameter(s) to add to the rest call made to the system to query for contents. View doc and this for additional details and options.
The to the entity_services module adds the query parameter options[parameters_op][<field_name>]
which will allow various operations to be applied with the parameters
query param.