Problem/Motivation

We're seeting this issue when using "Modify field values" action added by https://www.drupal.org/project/views_bulk_edit

vbo issue

Steps to reproduce

1. Install
https://www.drupal.org/project/views_bulk_edit
https://www.drupal.org/project/views_bulk_operations
https://www.drupal.org/project/yoast_seo

2. Add field of type "Real-time SEO status & focused keywords" to your content type

3. Try to bulk update content with "Modify field values" action.

Proposed resolution

This error should not happen.

CommentFileSizeAuthor
#7 3442563-7.patch1.45 KBsuhaib_hija
2024-04-22_16-44.png265.13 KBhkirsman

Comments

hkirsman created an issue. See original summary.

hkirsman’s picture

Title: Issue with VBO? » Issue with VBO or Views Bulk Edit?
Issue summary: View changes
hkirsman’s picture

Issue summary: View changes
ushma’s picture

Assigned: Unassigned » ushma
ushma’s picture

Assigned: ushma » Unassigned
eescribanoc’s picture

I have the same issue in several projects. I have debug to see what kind of form_object is at that state, it is a ConfigureAction form not an entity form. Ideally we would not want the field real-time to appear as a field we can alter in a bulk action.

So far, I am just removing the field manually with a hook_form_alter. This is the code, just in case it helps:

<?php
/**
 * Implements hook_form_views_bulk_operations_configure_action_alter().
 */
function module_form_views_bulk_operations_configure_action_alter(&$form, FormStateInterface $form_state) {
  $contentTypes = \Drupal::entityTypeManager()->getStorage('node_type')->loadMultiple();
  foreach ($contentTypes as $contentType) {
    if (isset($form['node'][$contentType->id()])) {
      unset($form['node'][$contentType->id()]['field_seo_real_time']);
      unset($form['node'][$contentType->id()]['field_seo_real_time_change_method']);
      unset($form['node'][$contentType->id()]['_field_selector']['field_seo_real_time']);
    }
  }
}
suhaib_hija’s picture

StatusFileSize
new1.45 KB

Added a check to ensure the form implements EntityFormInterface before adding SEO preview functionality. This prevents the code from running on non-entity forms entirely

suhaib_hija’s picture

Status: Active » Needs review