Pantheon Systems Drupal Kit
Utilities to help simplify the process of sourcing data from a Drupal backend for a Front-End Site hosted on Pantheon.
Installation
To install this package to use in your application:
npm install @pantheon-systems/drupal-kit
Usage
Modules can be imported from the @pantheon-systems/drupal-kit
package. For
example, to use Drupal State to source data from your CMS backend:
DrupalState
- Import DrupalState in your JavaScript application:
import { DrupalState } from ' @pantheon-systems/drupal-kit';
- Create an instance of the store and specify the root of your API:
const store = new DrupalState({
apiBase: 'https://dev-ds-demo.pantheonsite.io',
}); - Get a collection of objects:
const recipesFromApi = await store.getObject({ objectName: 'node--recipe' });
- Get a single object:
const recipeFromStore = await store.getObject({
objectName: 'node--recipe',
id: '33386d32-a87c-44b9-b66b-3dd0bfc38dca',
});
For more information, consult the full Drupal State documentation
API Reference
To see the API reference for @pantheon-systems/drupal-kit
,
visit our docs site
Contributing
Please see the Contributing guide in our monorepo to contribute to the project.