You are here

public function MigrateMetatagHandler::prepare in Metatag 7

Implements MigrateDestinationHandler::prepare().

File

./metatag.migrate.inc, line 117

Class

MigrateMetatagHandler
Metatag destination handler.

Code

public function prepare($entity, stdClass $row) {
  $elements = metatag_get_info();
  foreach ($elements['tags'] as $value) {
    $metatag_field = 'metatag_' . $value['name'];
    if (isset($entity->{$metatag_field})) {
      $language = isset($entity->language) ? $entity->language : LANGUAGE_NONE;
      $entity->metatags[$language][$value['name']]['value'] = $entity->{$metatag_field};
      unset($entity->{$metatag_field});
    }
  }
}