You are here

function metatag_translate_metatags in Metatag 7

Translate a set of metatags to the current language.

Parameters

array $metatags: List of meta tags to be translated.

string $context: An optional context to use with i18n.

string $langcode: The language code to submit instead of the current page's language.

bool $update: Whether or not to create/update records in {locales_source}.

3 calls to metatag_translate_metatags()
metatag_context_reaction::execute in metatag_context/metatag_context.context.inc
Output a list of active contexts.
metatag_panels_ctools_render_alter in metatag_panels/metatag_panels.module
Implements hook_ctools_render_alter().
metatag_views_page_alter in metatag_views/metatag_views.module
Implements hook_page_alter().

File

./metatag.module, line 3184
Primary hook implementations for Metatag.

Code

function metatag_translate_metatags(array &$metatags, $context = NULL, $langcode = NULL, $update = TRUE) {
  if (!empty($metatags)) {
    foreach ($metatags as $key => $data) {
      if (!empty($data['value']) && is_string($data['value'])) {
        $metatags[$key] = array(
          'value' => metatag_translate_metatag($data['value'], $key, $context, $langcode, $update),
        );
      }
    }
  }
}