Currently entity forms only have a link to add incoming URL redirects, it would be quite useful, especially for SEOs (e.g. Wordpress main SEO module has this), to have a link to add an outgoing URL redirect as well.

CommentFileSizeAuthor
#1 add-outgoing-redirect-1388396-1.patch2.63 KBoxyc

Comments

oxyc’s picture

Status: Active » Needs review
StatusFileSize
new2.63 KB

A first patch, I'm not really comfortable working with render arrays so this probably needs some polishing.

I also rephrased descriptions as incoming/outgoing as it became quite unclear once there were two link.

chris matthews’s picture

Issue summary: View changes
Status: Needs review » Needs work

The 7 year old patch not surprisingly does not apply to 7.x-1.x-dev and probably should not be re-rolled since it's so old.

Checking patch redirect.module...
error: while searching for:
  // We don't have to put our include in $form_state['build_info']['files']
  // since the build array will already be cached.
  module_load_include('inc', 'redirect', 'redirect.admin');
  $redirects = redirect_load_multiple(FALSE, array('redirect' => $uri['path']));
  $header = array('source', 'status_code', 'language', 'count', 'access', 'operations');
  $form['redirect'] += redirect_list_table($redirects, $header);

  $redirect = array(
    'redirect' => $uri['path'],
    'redirect_options' => array_diff_key($uri['options'], array('entity_type' => '', 'entity' => '')),
    'language' => $langcode,
  );

  $form['redirect']['actions'] = array(
    '#theme' => 'links',
    '#links' => array(),
    '#attributes' => array('class' => array('action-links')),
  );
  if (redirect_access('create', 'redirect')) {
    $form['redirect']['actions']['#links']['add'] = array(
      'title' => t('Add URL redirect to this @entitytype', array('@entitytype' => drupal_strtolower($info['label']))),
      'href' => 'admin/config/search/redirect/add',
      'query' => array_filter($redirect) + drupal_get_destination(),
    );
  }
}

error: patch failed: redirect.module:1412
error: redirect.module: patch does not apply
wylbur’s picture

Status: Needs work » Closed (outdated)

Closing this as Outdated as Drupal 7 is EOL.