metatagManager->sortedTags(); // Return only common elements. $metatags = array_intersect_key($metatags, $tags); return $metatags; } /** * Removes tags that are empty. */ public function removeEmptyTags($metatags) { $metatags = array_filter($metatags, function ($value) { if (is_array($value)) { return count(array_filter($value)) > 0; } else { return $value !== ''; } }); return $metatags; } }