You are here

protected function MigrateRedirectEntityHandler::getRedirects in Redirect 7

Same name and namespace in other branches
  1. 7.2 redirect.migrate.inc \MigrateRedirectEntityHandler::getRedirects()

Get redirects from entity or row.

1 call to MigrateRedirectEntityHandler::getRedirects()
MigrateRedirectEntityHandler::complete in ./redirect.migrate.inc
Overrides complete().

File

./redirect.migrate.inc, line 72
Migrate support for Redirect module.

Class

MigrateRedirectEntityHandler
@file Migrate support for Redirect module.

Code

protected function getRedirects($entity, $row) {

  // If there are multiple redirects defined for the entity, they will be in
  // $row. If there is just one, it will be in $entity.
  if (!empty($row->migrate_redirects)) {
    $migrate_redirects = $row->migrate_redirects;
  }
  else {
    $migrate_redirects = isset($entity->migrate_redirects) ? $entity->migrate_redirects : NULL;
  }

  // If it is not an array already, make it one now.
  if ($migrate_redirects && !is_array($migrate_redirects)) {
    $migrate_redirects = array(
      $migrate_redirects,
    );
  }
  return $migrate_redirects;
}