function metatag_translations_delete in Metatag 7
Remove the translated definitions of meta tags.
Parameters
array $metatags: List of meta tags to have their translations updated.
string $context: The string that will be used to group strings in the translation UI.
1 call to metatag_translations_delete()
- i18n_string_metatag_config_delete in ./
metatag.module - Implements hook_config_delete().
File
- ./
metatag.module, line 3245 - Primary hook implementations for Metatag.
Code
function metatag_translations_delete(array $metatags, $context) {
// Store the context as it was originally provided.
$original_context = $context;
// Update the i18n string.
if (module_exists('i18n_string') && !variable_get('metatag_i18n_disabled', FALSE)) {
$options = array();
// By default disable the watchdog logging of translation messages.
$options['watchdog'] = variable_get('metatag_i18n_enable_watchdog', FALSE);
foreach ($metatags as $tag_name => $data) {
// Revert the context, so that it can be changed if needed.
$context = $original_context;
if (!empty($data['value']) && is_string($data['value'])) {
// Triggers hook_metatag_i18n_context_alter() - allows the i18n string
// to be altered before being used.
drupal_alter('metatag_i18n_context', $context, $tag_name);
// Don't do anything if the context was erased - it's unlikely, but it
// could happen.
if (empty($context)) {
continue;
}
// The textgroup is the first part of the string.
i18n_string_remove("metatag:{$context}:{$tag_name}", $data['value'], $options);
}
}
}
}