Commit 9c957c31 authored by Marcos Cano's avatar Marcos Cano 💬 Committed by Damien McKenna
Browse files

Issue #3363366 by marcoscano, DamienMcKenna:...

Issue #3363366 by marcoscano, DamienMcKenna: metatag_generate_entity_metatags() no longer accepts NULL, causing BC-breaking change.
parent 72eae157
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -8,6 +8,8 @@ g#3363315 by DamienMcKenna: metatag_post_update_convert_author_data() doesn't
#3363231 by DamienMcKenna, jan kellermann: remove_robots_noydir_noodp:
  TypeError: explode(): Argument #2 ($string) must be of type string, array
  given.
#3363366 by marcoscano, DamienMcKenna: metatag_generate_entity_metatags() no
  longer accepts NULL, causing BC-breaking change.


Metatag 8.x-1.24, 2023-05-26
+15 −3
Original line number Diff line number Diff line
@@ -621,17 +621,29 @@ function metatag_entity_base_field_info(EntityTypeInterface $entity_type) {
/**
 * Turn the meta tags for an entity into a human readable structure.
 *
 * @param \Drupal\Core\Entity\ContentEntityInterface $entity
 *   The entity object.
 * @param object|null $entity
 *   The entity object. May be skipped by passing NULL as the argument, which
 *   defers to loading the current route's entity; this is an unintended
 *   consequence of the function's poor definition.
 *
 * @return array
 *   All of the meta tags in a nested structure.
 *
 * @deprecated in metatag:8.x-1.23 and is removed from metatag:2.0.0. Use metatag_generate_entity_all_tags() instead.
 * @deprecated in metatag:8.x-1.23 and is removed from metatag:2.0.0. Use metatag_generate_entity_all_tags() instead; note that callers should always pass the entity to metatag_generate_entity_all_tags(), which is different from the behavior of metatag_generate_entity_metatags().
 *
 * @see https://www.drupal.org/node/3332350
 */
function metatag_generate_entity_metatags($entity) {
  // For backwards compatibility.
  if (empty($entity)) {
    $entity = metatag_get_route_entity();
  }
  // This is tecnnical a backwards compatibility break, but the "spirit" of this
  // function was that it was always intended to be used on content entities.
  if (!($entity instanceof ContentEntityInterface)) {
    return [];
  }
  // Defer to the replacement function.
  return metatag_generate_entity_all_tags($entity);
}