# Drupal v9

The source Drupal v9 connector allows content, user, files and folders to be picked up from a Drupal v9 system and transformed into motation.

## Specifics

### Setup

To set up drupal 9 as a rest server for ImpulseSync to connect to there are a number of requirements to be met.&#x20;

#### Configuration

A number of modules must be enabled.&#x20;

Multilingual -> Content Translation

Multilingual -> Language

<figure><img src="https://lh7-us.googleusercontent.com/8FKf3yEPpfqJHArnD0-vEvswkW8MAfJcrZPa_WmgTUzDo-BLHdMc-B-CHFMyOVUr1KLTtpemkJGPRcrjA1D3_g9-QvjIJMl09Eq8FBcsL2iAXIHOVcuVprD6gtfHJQmP6S78uuiRa3MV0W9NJ8wcvZM" alt=""><figcaption></figcaption></figure>

Web services -> HTTP Basic Authentication

Web services -> JSON:API

Web services -> RESTful Web Services

Web services -> Serialization

<figure><img src="https://lh7-us.googleusercontent.com/N5UppBQz0vp8jvbho4auTOx71ne5-rBDTlSkKoogpiU3f20_CEPaHY13WvrlZV-CTWdVWHr4HVl6xo3bLO_vzUj4k-3EAx3KTMWUwZmYSJl-Fd-WAAnAf8teUAwf54zL5mvpjrDQpvoozN3aAtNGIb0" alt=""><figcaption></figcaption></figure>

### Endpoint Config

When saving an endpoint for a Drupal v9 repository via REST instead of the UI you must use the following key:value pairs in the payload.

* `contentRepo:drupal`
* `contentRepoVersion:v9`

### Connector queries for child folders

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.&#x20;

### User reference field

Contents in Drupal 9 have both two user references built into them. `uid` and `revision_uid`. The `uid` field is used to create a relationship field to that user. The `revision_uid` field is not supported.&#x20;

The user content has a content type `user--user`.&#x20;

### Language

The JSON:API does not have full support of languages. So there may be some limitations to language support.&#x20;

Part of this is how/when the default language/translation is returned. If a language does not have a translation for a content, the default translation will be returned.&#x20;

### Link Field Type

A field with the Drupal Link field type will be set as a Motation String field type with **two values.** The first value is the URL. The second value is the Link text. This allows for manipulators such as the Liquid field manipulator to access both values and manipulate them as necessary.&#x20;

### Number Field Type

All number field types are converted to a float value in Motation. This means that the value may require additional parsing to convert the number to the correct accuracy. i.e., the Number (integer) field type may have value of 7 in the system. But in Motation this is a value of 7.0000 with field type Float. The Liquid field manipulator can be used to "round" the value to an integer value for the destination connector.&#x20;

### Folders

A folder is created per folder in the path.&#x20;

The entire folder path is dependent on if the files are hosted local to the system or not.&#x20;

#### locally hosted

If they are local to the system, the folder path will be the the url path of the binary without the domain.&#x20;

i.e., if an image has the url [http://example.com/sites/default/files/2023-10/1.png](http://localhost:9001/sites/default/files/2023-10/1.png)\
then the full folder path will be `sites/default/files/2023-10`. This is then split into 4 separate folders.&#x20;

1. sites
2. sites/default
3. sites/default/files
4. sites/default/files/2023-10

#### remote hosted

If they are not hosted local to the system, the folder path will be the url domain and the url path of the binary.&#x20;

i.e., if an image has the url [https://example.com/platform/files/public/2023-11/background/image.jpg?VersionId=LSxckf5AuOOHIr\_fzRS4l1fbC6fMAJ99](https://cdn.winsightmedia.com/platform/files/public/2023-11/background/Birria%20opener.jpg?VersionId=LSxckf5AuOOHIr_fzRS4l1fbC6fMAJ99)\
Then the full folder path will be `example.com/platform/files/public/2023-11/background`. This is then split into 6 separate folders.&#x20;

1. example.com
2. example.com/platform
3. example.com/platform/files
4. example.com/platform/files/public
5. example.com/platform/files/public/2023-11
6. example.com/platform/files/public/2023-11/background

### Unsupported

Entity Reference field with non content target type. i.e., user, taxonomy, file, comment. Only entity reference to content is supported.&#x20;

<figure><img src="https://651785290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnLYwCtfZtrK4s43AVzb4%2Fuploads%2FEUCxn00s9Kr08NPPCdYP%2Fimage.png?alt=media&#x26;token=5a718aec-8d63-4758-b0fc-9439901c0b9e" alt=""><figcaption></figcaption></figure>

Comments are unsupported.&#x20;

Comment field is unsupported.

Anonymous user is not picked up as it does not have all the required attributes. (i.e., `changed`)

User's picture field.

Field types from imported modules beyond what core Drupal v9 has.&#x20;

The following list of fields are ignored not set as a field when transforming Drupal v9 content into Motation: &#x20;

```
comment
node_type
```

## Adapter Properties

| Property                      | Purpose                                                                    |
| ----------------------------- | -------------------------------------------------------------------------- |
| 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) |

## Job Options

| Name        | Description                                                                                                                                                                                                                            | Data Type | Required | Default Value    |
| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | -------- | ---------------- |
| contentType | The content type to pick up.                                                                                                                                                                                                           | Text      | true     | No Default Value |
| folder      | The folder path to pick up files from.                                                                                                                                                                                                 | Text      | false    | No Default Value |
| languages   | A '\|' separated list of languages to pick up contents from                                                                                                                                                                            | Text      | false    | No Default Value |
| query       | <p>Query params to add to the rest call to pick up content IDs with. </p><p>View <a href="https://www.drupal.org/docs/core-modules-and-themes/core-modules/jsonapi-module/filtering">JSON:API</a> for additional details. </p><p> </p> | Text      | false    | No Default Value |

### *contentType* job option

The content type job option is the content type to pick up.&#x20;

<figure><img src="https://651785290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnLYwCtfZtrK4s43AVzb4%2Fuploads%2Ff7jWNAGuqMXyPkDMOxFM%2Fimage.png?alt=media&#x26;token=cad16668-da01-4ffd-aa5c-db3f2717668e" alt=""><figcaption></figcaption></figure>

### IMPULSE\_ASSET keyword

The keyword IMPULSE\_ASSET can be used in the contentType job option to pick up files.&#x20;

<figure><img src="https://651785290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnLYwCtfZtrK4s43AVzb4%2Fuploads%2FMG0TDq6bIH0VqXVwsUBU%2Fimage.png?alt=media&#x26;token=0d17e857-e4c2-4af9-a680-2f48036ef759" alt=""><figcaption></figcaption></figure>

### IMPULSE\_USER keyword

The keyword IMPULSE\_USER can be used in the contentType job option to pick up users as a content.&#x20;

<figure><img src="https://651785290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnLYwCtfZtrK4s43AVzb4%2Fuploads%2F1C0ySwyz53afzFps5ZfY%2Fimage.png?alt=media&#x26;token=e049cc62-6aec-4178-aee8-43bdb8cb720f" alt=""><figcaption></figcaption></figure>

### *folder* job option

This option is paired with the IMPULSE\_ASSET content type to limit the files picked up to a specific folder.&#x20;

The folder job option is the folder to pick up files from.&#x20;

<figure><img src="https://651785290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnLYwCtfZtrK4s43AVzb4%2Fuploads%2FDzKmCV1705VGFVv68If5%2Fimage.png?alt=media&#x26;token=c2d02ffd-7149-48e2-a629-d02f86af7f80" alt=""><figcaption></figcaption></figure>

## *language* job option

This option is used to specify what translations (languages) of content should be picked up. It is a list of language codes separated by a pipe `|`. If you want to pick up the default language either pass the value `DEFAULT_LANG` or an empty value after a pipe.&#x20;

Each language code will be set in the request path to get the language's translation of each content picked up. Be aware that the default language code may not be a valid to set in the request path, thus you may need to use the`DEFAULT_LANG` value.&#x20;

<figure><img src="https://651785290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnLYwCtfZtrK4s43AVzb4%2Fuploads%2FyMX5Bw5Hab8xotdZm8mW%2Fimage.png?alt=media&#x26;token=e4e9e108-48a6-465e-8aaa-c198ce644943" alt=""><figcaption></figcaption></figure>

## *query* job option

The value set is query parameter(s) to add to the rest call made to the system to query for contents. View [JSON:API](https://www.drupal.org/docs/core-modules-and-themes/core-modules/jsonapi-module/filtering) doc for additional details and options.&#x20;

## Motation Object Support

| Object       | Supported |
| ------------ | --------- |
| Category     | No        |
| Definition   | Yes       |
| Domain       | No        |
| Folder       | Yes       |
| Language     | No        |
| Relationship | Yes       |
| Tag          | Yes       |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://motivlabs.gitbook.io/impulse-user-manual/connectors/source-connectors/drupal-v9.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
