Loading CHANGELOG.txt +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ Metatag 8.x-1.x-dev, xxxx-xx-xx tokens. #3171302 by ankithashetty, DamienMcKenna: \Drupal calls should be avoided in classes, use dependency injection instead. #2996883 by rokzabukovec, mrinalini9, thejimbirch, DamienMcKenna, Nchase, Schwarz Developing: Sorting the output of meta tags. Metatag 8.x-1.14, 2020-08-11 Loading src/MetatagManager.php +12 −8 Original line number Diff line number Diff line Loading @@ -535,17 +535,21 @@ class MetatagManager implements MetatagManagerInterface { $metatag_tags = $this->tagPluginManager->getDefinitions(); // Order the elements by weight first, as some systems like Facebook care. uksort($tags, function ($tag_name_a, $tag_name_b) use ($metatag_tags) { $weight_a = isset($metatag_tags[$tag_name_a]['weight']) ? $metatag_tags[$tag_name_a]['weight'] : 0; $weight_b = isset($metatag_tags[$tag_name_b]['weight']) ? $metatag_tags[$tag_name_b]['weight'] : 0; // Order metatags based on the group and weight. $group = array_column($metatag_tags, 'group'); $weight = array_column($metatag_tags, 'weight'); array_multisort($group, SORT_ASC, $weight, SORT_ASC, $metatag_tags); return ($weight_a < $weight_b) ? -1 : 1; }); $ordered_tags = []; foreach ($metatag_tags as $metatag) { if (isset($tags[$metatag['id']])) { $ordered_tags[$metatag['id']] = $tags[$metatag['id']]; } } // Each element of the $values array is a tag with the tag plugin name as // the key. foreach ($tags as $tag_name => $value) { foreach ($ordered_tags as $tag_name => $value) { // Check to ensure there is a matching plugin. if (isset($metatag_tags[$tag_name])) { // Get an instance of the plugin. Loading Loading
CHANGELOG.txt +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ Metatag 8.x-1.x-dev, xxxx-xx-xx tokens. #3171302 by ankithashetty, DamienMcKenna: \Drupal calls should be avoided in classes, use dependency injection instead. #2996883 by rokzabukovec, mrinalini9, thejimbirch, DamienMcKenna, Nchase, Schwarz Developing: Sorting the output of meta tags. Metatag 8.x-1.14, 2020-08-11 Loading
src/MetatagManager.php +12 −8 Original line number Diff line number Diff line Loading @@ -535,17 +535,21 @@ class MetatagManager implements MetatagManagerInterface { $metatag_tags = $this->tagPluginManager->getDefinitions(); // Order the elements by weight first, as some systems like Facebook care. uksort($tags, function ($tag_name_a, $tag_name_b) use ($metatag_tags) { $weight_a = isset($metatag_tags[$tag_name_a]['weight']) ? $metatag_tags[$tag_name_a]['weight'] : 0; $weight_b = isset($metatag_tags[$tag_name_b]['weight']) ? $metatag_tags[$tag_name_b]['weight'] : 0; // Order metatags based on the group and weight. $group = array_column($metatag_tags, 'group'); $weight = array_column($metatag_tags, 'weight'); array_multisort($group, SORT_ASC, $weight, SORT_ASC, $metatag_tags); return ($weight_a < $weight_b) ? -1 : 1; }); $ordered_tags = []; foreach ($metatag_tags as $metatag) { if (isset($tags[$metatag['id']])) { $ordered_tags[$metatag['id']] = $tags[$metatag['id']]; } } // Each element of the $values array is a tag with the tag plugin name as // the key. foreach ($tags as $tag_name => $value) { foreach ($ordered_tags as $tag_name => $value) { // Check to ensure there is a matching plugin. if (isset($metatag_tags[$tag_name])) { // Get an instance of the plugin. Loading