Impossible to add a yoast_seo field

Created on 1 March 2024, 9 months ago
Updated 4 March 2024, 9 months ago

Problem/Motivation

Drupal: 10.2.3

When trying to create a new field. There is an ajax error which prevents saving the field:

"
An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /admin/structure/types/manage/page/add-field/node/field_yoast_seo?destinations%5B0%5D%5Broute_name%5D=entity.node.field_ui_fields&destinations%5B0%5D%5Broute_parameters%5D%5Bentity_type%5D=node&destinations%5B0%5D%5Broute_parameters%5D%5Bfield_name%5D=field_yoast_seo&destinations%5B0%5D%5Broute_parameters%5D%5Bnode_type%5D=page&destinations%5B1%5D=/admin/structure/types/manage/page/fields/add-field&ajax_form=1
StatusText: parsererror
ResponseText: TypeError: Drupal\yoast_seo\EntityAnalyser::createEntityPreview(): Argument #3 ($view_mode) must be of type string, null given, called in /project/app/modules/contrib/yoast_seo/src/Form/AnalysisFormHandler.php on line 75 in Drupal\yoast_seo\EntityAnalyser->createEntityPreview() (line 116 of /project/app/modules/contrib/yoast_seo/src/EntityAnalyser.php)."

In app/modules/contrib/yoast_seo/src/Form/AnalysisFormHandler.php::analysisSubmitAjax():

    $entity_data = $this->entityAnalyser->createEntityPreview(
      $preview_entity,
      $form['#yoast_settings']['render_theme'],
      $form['#yoast_settings']['render_view_mode']
    );

As the field is not saved yet, not possible to set its settings.

Steps to reproduce

On Drupal 10.2.3, try to add a new yoast_seo field.

Proposed resolution

Have default configuration or optional parameters.

Remaining tasks

Implement a fix.

🐛 Bug report
Status

Active

Component

Code

Created by

🇫🇷France Grimreaper France 🇫🇷

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024