Commit 8c646840 authored by Damien McKenna's avatar Damien McKenna Committed by Damien McKenna
Browse files

Issue #3358948 by DamienMcKenna: Add a function for abstracting the field data encoding method.

parent f6a3be45
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -47,6 +47,8 @@ Metatag 8.x-1.x-dev, 2022-xx-xx
  meta tags.
#3336301 by RenatoG, DamienMcKenna: Unnecessary else in
  metatag_post_update_convert_author_data().
#3358948 by DamienMcKenna: Add a function for abstracting the field data
  encoding method.


Metatag 8.x-1.22, 2022-09-29
+16 −0
Original line number Diff line number Diff line
@@ -1042,3 +1042,19 @@ function metatag_data_decode($string): array {

  return $data;
}

/**
 * Encode the data for storing in a Metatag field.
 *
 * By abstracting to this function each version of Metatag can use the method
 * that is appropriate for it.
 *
 * @param array $data
 *   A Metatag values array.
 *
 * @return string
 *   The meta tag data encoded as a JSON string.
 */
function metatag_data_encode(array $data = []): string {
  return serialize($data);
}