public function MetatagManager::sortedGroupsWithTags in Metatag 8
Returns a weighted array of groups containing their weighted tags.
Return value
array Array of sorted tags, in groups.
Overrides MetatagManagerInterface::sortedGroupsWithTags
1 call to MetatagManager::sortedGroupsWithTags()
- MetatagManager::form in src/
MetatagManager.php - Builds the form element for a Metatag field.
File
- src/
MetatagManager.php, line 236
Class
- MetatagManager
- Class MetatagManager.
Namespace
Drupal\metatagCode
public function sortedGroupsWithTags() {
$groups = $this
->sortedGroups();
$tags = $this
->sortedTags();
foreach ($tags as $tag_name => $tag) {
$tag_group = $tag['group'];
if (!isset($groups[$tag_group])) {
// If the tag is claiming a group that has no matching plugin, log an
// error and force it to the basic group.
$this->logger
->error("Undefined group '%group' on tag '%tag'", [
'%group' => $tag_group,
'%tag' => $tag_name,
]);
$tag['group'] = 'basic';
$tag_group = 'basic';
}
$groups[$tag_group]['tags'][$tag_name] = $tag;
}
return $groups;
}