Commit 4d1f3f77 authored by Damien McKenna's avatar Damien McKenna Committed by Damien McKenna
Browse files

Issue #3366933 by DamienMcKenna, Jabastin Arul, dk-massive: Errors in field...

Issue #3366933 by DamienMcKenna, Jabastin Arul, dk-massive: Errors in field configuration can lead metatag_post_update_remove_robots_noydir_noodp() to fail.
parent bedd1afc
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -10,6 +10,9 @@ Metatag 8.x-1.x-dev, 2023-xx-xx
  fixture file.
By DamienMcKenna: Run updates in batches of 100 records, not 10.
#3367290 by DamienMcKenna: Streamline the post update scripts.
#3366933 by DamienMcKenna, Jabastin Arul, dk-massive: Errors in field
  configuration can lead metatag_post_update_remove_robots_noydir_noodp() to
  fail.


Metatag 8.x-1.25, 2023-05-31
+13 −6
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
 * Post update functions for Metatag.
 */

use Drupal\Component\Plugin\Exception\PluginNotFoundException;
use Drupal\Core\Config\Entity\ConfigEntityUpdater;
use Drupal\metatag\Entity\MetatagDefaults;

@@ -39,12 +40,18 @@ function _metatag_list_entity_field_tables(): array {
      $field_name = $field_storage->getName();

      // Get the individual fields (field instances) associated with bundles.
      // This query can result in an exception
      try {
        $fields = $entity_type_manager
          ->getStorage('field_config')
          ->loadByProperties([
            'field_name' => $field_name,
            'entity_type' => $field_storage->getTargetEntityTypeId(),
          ]);
      }
      catch (PluginNotFoundException $e) {
        throw new \Exception("There is a problem in the field configuration, see https://www.drupal.org/node/3366933 for discussion on how to resolve it.\nOriginal message: " . $e->getMessage());
      }

      $tables = [];
      foreach ($fields as $field) {