function schema_metatag_update_8107 in Schema.org Metatag 8.2
Same name and namespace in other branches
- 8 schema_metatag.install \schema_metatag_update_8107()
Update the schema_product_brand tag.
File
- ./
schema_metatag.install, line 175 - Update scripts for the Schema Metatag module.
Code
function schema_metatag_update_8107() {
/**
* Metatag default values.
*
* @var Drupal\metatag\Entity\MetatagDefaults
*/
$configs = MetatagDefaults::loadMultiple();
foreach ($configs as $config) {
$tags = $config
->get('tags');
foreach ($tags as $tag_name => $tag) {
if ($tag_name == 'schema_product_brand') {
$value = [
'@type' => 'Brand',
'name' => $tag,
];
$new_tag = SchemaMetatagManager::serialize($value);
$tags[$tag_name] = $new_tag;
$config
->set('tags', $tags);
$config
->save();
}
}
}
return (string) t("Options for Product brands have been expanded and brand options have been added to Organization and Person, please review and update your configuration if you use brands.");
}