Skip to content

Commit

Permalink
feat(next): update Next.js settings to add draft mode
Browse files Browse the repository at this point in the history
Issue #502
  • Loading branch information
JohnAlbin committed Jan 29, 2024
1 parent 2f8c937 commit 03f5736
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions modules/next/src/Form/NextSiteForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,32 +51,32 @@ public function form(array $form, FormStateInterface $form_state) {
];

$form['preview'] = [
'#title' => $this->t('Preview Mode'),
'#description' => $this->t('Preview mode allows editors to preview content on the site. You can read more on the <a href=":uri" target="_blank">Next.js documentation</a>.', [
':uri' => 'https://nextjs.org/docs/advanced-features/preview-mode',
'#title' => $this->t('Draft Mode'),
'#description' => $this->t('Draft mode (or the deprecated Preview mode) allows editors to preview content on the site. You can read more on the <a href=":uri" target="_blank">Next.js documentation</a>.', [
':uri' => 'https://nextjs.org/docs/app/building-your-application/configuring/draft-mode',
]),
'#type' => 'details',
'#group' => 'settings',
];

$form['preview']['preview_url'] = [
'#type' => 'url',
'#title' => $this->t('Preview URL'),
'#description' => $this->t('Enter the preview URL. Example: <em>https://example.com/api/preview</em>.'),
'#title' => $this->t('Draft URL (or Preview URL)'),
'#description' => $this->t('Enter the draft URL or preview URL. Example: <em>https://example.com/api/draft</em> or <em>https://example.com/api/preview</em>.'),
'#default_value' => $entity->getPreviewUrl(),
];

$form['preview']['preview_secret'] = [
'#type' => 'textfield',
'#title' => $this->t('Preview secret'),
'#description' => $this->t('Enter a secret for the site preview. This is the same value used for <em>DRUPAL_PREVIEW_SECRET</em>.'),
'#title' => $this->t('Draft secret (or Preview secret)'),
'#description' => $this->t('Enter a secret for the site draft/preview. This must be unique for each Next.js site'),
'#default_value' => $entity->getPreviewSecret(),
];

$form['revalidation'] = [
'#title' => $this->t('On-demand Revalidation'),
'#description' => $this->t('On-demand revalidation updates your pages when content is updated on your Drupal site. You can read more on the <a href=":uri" target="_blank">Next.js documentation</a>.', [
':uri' => 'https://nextjs.org/docs/advanced-features/preview-mode',
':uri' => 'https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#revalidating-data',
]),
'#type' => 'details',
'#group' => 'settings',
Expand Down

0 comments on commit 03f5736

Please sign in to comment.