diff --git a/modules/next/composer.json b/modules/next/composer.json index 05f49ac4..48cea01e 100644 --- a/modules/next/composer.json +++ b/modules/next/composer.json @@ -1,6 +1,6 @@ { "name": "drupal/next", - "description": "Next.js + Drupal for Incremental Static Regeneration and Preview mode.", + "description": "Next.js + Drupal for Incremental Static Regeneration and Draft mode.", "type": "drupal-module", "homepage": "http://drupal.org/project/next", "license": "GPL-2.0-or-later", diff --git a/modules/next/modules/next_jwt/src/Plugin/Next/PreviewUrlGenerator/Jwt.php b/modules/next/modules/next_jwt/src/Plugin/Next/PreviewUrlGenerator/Jwt.php index c5676e21..f09b2f59 100644 --- a/modules/next/modules/next_jwt/src/Plugin/Next/PreviewUrlGenerator/Jwt.php +++ b/modules/next/modules/next_jwt/src/Plugin/Next/PreviewUrlGenerator/Jwt.php @@ -103,8 +103,8 @@ public function defaultConfiguration() { */ public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $form['secret_expiration'] = [ - '#title' => $this->t('Preview secret expiration time'), - '#description' => $this->t('The value, in seconds, to be used as expiration time for the preview secret. It is recommended to use short-lived secrets for increased security.'), + '#title' => $this->t('Secret expiration time'), + '#description' => $this->t('The value, in seconds, to be used as expiration time for the validation secret. It is recommended to use short-lived secrets for increased security.'), '#type' => 'number', '#required' => TRUE, '#default_value' => $this->configuration['secret_expiration'], diff --git a/modules/next/next.info.yml b/modules/next/next.info.yml index de7eaf0a..42872eb2 100644 --- a/modules/next/next.info.yml +++ b/modules/next/next.info.yml @@ -1,5 +1,5 @@ name: Next.js -description: Next.js + Drupal for Incremental Static Regeneration and Preview mode. +description: Next.js + Drupal for Incremental Static Regeneration and Draft mode. type: module core_version_requirement: ^9 || ^10 package: Web services diff --git a/modules/next/src/Controller/NextSiteEntityController.php b/modules/next/src/Controller/NextSiteEntityController.php index 07fab5a7..d6e280e8 100644 --- a/modules/next/src/Controller/NextSiteEntityController.php +++ b/modules/next/src/Controller/NextSiteEntityController.php @@ -64,7 +64,7 @@ public function environmentVariables(NextSiteInterface $next_site) { if ($secret = $next_site->getPreviewSecret()) { $variables += [ - 'preview_variables' => '# Required for Preview Mode', + 'preview_variables' => '# Required for Draft Mode', 'DRUPAL_PREVIEW_SECRET' => $secret, ]; } diff --git a/modules/next/src/Form/NextEntityTypeConfigForm.php b/modules/next/src/Form/NextEntityTypeConfigForm.php index feb56514..37d2e65b 100644 --- a/modules/next/src/Form/NextEntityTypeConfigForm.php +++ b/modules/next/src/Form/NextEntityTypeConfigForm.php @@ -119,16 +119,16 @@ public function form(array $form, FormStateInterface $form_state) { '#title' => $this->t('Settings'), ]; - $form['preview_mode'] = [ - '#title' => $this->t('Preview Mode'), - '#description' => $this->t('Configure preview mode the entity type.'), + $form['draft_mode'] = [ + '#title' => $this->t('Draft Mode'), + '#description' => $this->t('Configure draft mode for this entity type.'), '#type' => 'details', '#group' => 'settings', ]; - $form['preview_mode']['site_resolver'] = [ + $form['draft_mode']['site_resolver'] = [ '#title' => $this->t('Plugin'), - '#description' => $this->t('Select a plugin to use for resolving the preview site for this entity type.'), + '#description' => $this->t('Select a plugin to use when validating the draft url for this entity type.'), '#type' => 'select', '#options' => array_merge(['' => $this->t('None')], array_column($this->siteResolverManager->getDefinitions(), 'label', 'id')), '#default_value' => $entity->getSiteResolver() ? $entity->getSiteResolver()->getId() : NULL, @@ -142,7 +142,7 @@ public function form(array $form, FormStateInterface $form_state) { ], ]; - $form['preview_mode']['site_resolver_settings_container'] = [ + $form['draft_mode']['site_resolver_settings_container'] = [ '#type' => 'container', '#prefix' => '
', '#suffix' => '
', @@ -152,7 +152,7 @@ public function form(array $form, FormStateInterface $form_state) { if ($site_resolver instanceof ConfigurableSiteResolverInterface) { $form['configuration'] = []; $subform_state = SubformState::createForSubform($form['configuration'], $form, $form_state); - $form['preview_mode']['site_resolver_settings_container']['configuration'] = $site_resolver->buildConfigurationForm($form['configuration'], $subform_state); + $form['draft_mode']['site_resolver_settings_container']['configuration'] = $site_resolver->buildConfigurationForm($form['configuration'], $subform_state); } $form['revalidation'] = [ @@ -223,7 +223,7 @@ public function submitSiteResolver(array $form, FormStateInterface $form_state) * Handles switching the site resolver selector. */ public function ajaxReplaceSiteResolverSettingsForm($form, FormStateInterface $form_state) { - return $form['preview_mode']['site_resolver_settings_container']; + return $form['draft_mode']['site_resolver_settings_container']; } /** diff --git a/modules/next/src/Form/NextSettingsForm.php b/modules/next/src/Form/NextSettingsForm.php index ac938209..9d1b4181 100644 --- a/modules/next/src/Form/NextSettingsForm.php +++ b/modules/next/src/Form/NextSettingsForm.php @@ -87,14 +87,14 @@ public function buildForm(array $form, FormStateInterface $form_state) { ]; $form['preview_url_generator_container'] = [ - '#title' => $this->t('Preview URL'), + '#title' => $this->t('Draft Mode'), '#type' => 'details', '#group' => 'settings', ]; $form['preview_url_generator_container']['preview_url_generator'] = [ '#title' => $this->t('Plugin'), - '#description' => $this->t('Select a plugin to use for the preview URL generator.'), + '#description' => $this->t('Select a plugin to use for the draft validation generator.'), '#type' => 'select', '#options' => array_column($this->previewUrlGeneratorManager->getDefinitions(), 'label', 'id'), '#default_value' => $config->get('preview_url_generator'), diff --git a/modules/next/src/Form/NextSiteForm.php b/modules/next/src/Form/NextSiteForm.php index 94aa6683..9ccfd0d2 100644 --- a/modules/next/src/Form/NextSiteForm.php +++ b/modules/next/src/Form/NextSiteForm.php @@ -51,9 +51,9 @@ 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 Next.js documentation.', [ - ':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 Next.js documentation.', [ + ':uri' => 'https://nextjs.org/docs/app/building-your-application/configuring/draft-mode', ]), '#type' => 'details', '#group' => 'settings', @@ -61,22 +61,22 @@ public function form(array $form, FormStateInterface $form_state) { $form['preview']['preview_url'] = [ '#type' => 'url', - '#title' => $this->t('Preview URL'), - '#description' => $this->t('Enter the preview URL. Example: https://example.com/api/preview.'), + '#title' => $this->t('Draft URL (or Preview URL)'), + '#description' => $this->t('Enter the draft URL or preview URL. Example: https://example.com/api/draft or https://example.com/api/preview.'), '#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 DRUPAL_PREVIEW_SECRET.'), + '#title' => $this->t('Secret key'), + '#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 Next.js documentation.', [ - ':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', diff --git a/modules/next/src/Plugin/Next/PreviewUrlGenerator/SimpleOauth.php b/modules/next/src/Plugin/Next/PreviewUrlGenerator/SimpleOauth.php index ec17960f..bb15e7bc 100644 --- a/modules/next/src/Plugin/Next/PreviewUrlGenerator/SimpleOauth.php +++ b/modules/next/src/Plugin/Next/PreviewUrlGenerator/SimpleOauth.php @@ -83,8 +83,8 @@ public function defaultConfiguration() { */ public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $form['secret_expiration'] = [ - '#title' => $this->t('Preview secret expiration time'), - '#description' => $this->t('The value, in seconds, to be used as expiration time for the preview secret. It is recommended to use short-lived secrets for increased security.'), + '#title' => $this->t('Secret expiration time'), + '#description' => $this->t('The value, in seconds, to be used as expiration time for the validation secret. It is recommended to use short-lived secrets for increased security.'), '#type' => 'number', '#required' => TRUE, '#default_value' => $this->configuration['secret_expiration'],