You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/next-drupal/src/next-drupal-pages.ts
+56-2Lines changed: 56 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -88,10 +88,64 @@ export class NextDrupalPages extends NextDrupal {
88
88
/**
89
89
* Gets a resource from the context.
90
90
*
91
-
* @param {string | DrupalTranslatedPath} input The input path or translated path.
92
-
* @param {GetStaticPropsContext} context The static props context.
91
+
* @param {string | DrupalTranslatedPath} input Either a resource type (e.g. "node--article") or a translated path from translatePath().
92
+
* @param {GetStaticPropsContext} context The Next.js context from getStaticProps.
93
93
* @param {Object} options Options for the request.
94
+
* @param {PathPrefix} [options.pathPrefix] The path prefix to use for the request (defaults to "/").
95
+
* @param {boolean} [options.isVersionable] Whether the resource is versionable (defaults to false for all entity types except nodes).
94
96
* @returns {Promise<T>} The fetched resource.
97
+
* @remarks
98
+
* The localized resource will be fetched based on the `locale` and `defaultLocale` values from `context`.
99
+
*
100
+
* If you pass in a `DrupalTranslatedPath` for input, `getResourceFromContext` will take the `type` and `id` from the path and make a `getResource` call to Drupal:
* If you pass in a `string` input, such as `node--article`, `getResourceFromContext` will make a subrequest call to Drupal to translate the path and then fetch the resource.
116
+
* You will need both the [Subrequests](https://drupal.org/project/subrequests) and [Decoupled Router](https://drupal.org/project/decoupled_router) modules:
0 commit comments