You are here

function redirect_object_prepare in Redirect 7

Same name and namespace in other branches
  1. 7.2 redirect.module \redirect_object_prepare()
9 calls to redirect_object_prepare()
drush_redirect_create_redirect in ./redirect.drush.inc
Command callback. Validates and adds a redirect.
MigrateRedirectEntityHandler::complete in ./redirect.migrate.inc
Overrides complete().
RedirectTestHelper::addRedirect in ./redirect.test
Add an URL redirection
redirect_edit_form in ./redirect.admin.inc
Form builder to add or edit an URL redirect.
redirect_generate_batch_generate in ./redirect.generate.inc

... See full list

File

./redirect.module, line 775

Code

function redirect_object_prepare($redirect, $defaults = array()) {
  $defaults += array(
    'rid' => NULL,
    'type' => 'redirect',
    'uid' => $GLOBALS['user']->uid,
    'source_options' => array(),
    'redirect_options' => array(),
    'language' => LANGUAGE_NONE,
    'status_code' => 0,
    'count' => 0,
    'access' => 0,
    'hash' => '',
    'status' => 1,
  );
  foreach ($defaults as $key => $default) {
    if (!isset($redirect->{$key})) {
      $redirect->{$key} = $default;
    }
  }
  module_invoke_all('redirect_prepare', $redirect);
}