- Issue created by @kaszarobert
- π΅π±Poland zambrey
I can confirm that this module breaks the entity reference fields (in my case with Media Library widget) where the weight of the items is not saved.
The problem is most likely related with changing the handler class for entity forms in yoast_seo.module:
function yoast_seo_entity_type_build(array &$entity_types) { /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */ foreach ($entity_types as &$entity_type) { if (!$entity_type->hasHandlerClass('yoast_seo_preview_form')) { $entity_type->setHandlerClass('yoast_seo_preview_form', AnalysisFormHandler::class); } } }
Commenting out the line with setHanderClass() call fixes for me the issue with item ordering.
- π«π·France guilhom Toulouse
I struggled with a bug with the Media Library widget where the weight wasn't being saved correctly until I discovered that removing the field from this Yoast module made everything go back to normal.
Did you find a solution zambrey to solve this issue because I assume that creating a patch to comment this line will break the Yoast SEO plugin behavior ?
- π΅πΉPortugal neliofga
I can also confirm that the Media Library widget no longer saves the item weights when the Real-time SEO field is included.
There's another open issue regarding the same behavior:
https://www.drupal.org/project/yoast_seo/issues/3354563 π Medialibrary sorting not working, when module is in use ActiveIt appears to happen while building the entity in the AnalysisFormHandler:
$preview_entity = $form_object->buildEntity($form, $form_state);
public function cacheProcessedEntityForPreview(array $form, FormStateInterface $form_state) { // Prevent firing accidental submissions from entity builder callbacks. $form_state->setTemporaryValue('entity_validated', FALSE); $form_object = $form_state->getFormObject(); assert($form_object instanceof EntityFormInterface, "Calling " . __FUNCTION__ . " for a form that's not an entity form is invalid."); $preview_entity = $form_object->buildEntity($form, $form_state); $form_state->setTemporaryValue('preview_entity', $preview_entity); }