You are here

function _neutral_paths_set_all_to_neutral in Neutral paths 7

Resets entity type language.

Resets path aliases referring to particular entity type to be language neutral.

3 calls to _neutral_paths_set_all_to_neutral()
neutral_paths_admin_submit_reset_node in ./neutral_paths.module
Responds to a command to reset node paths language.
neutral_paths_admin_submit_reset_taxonomy in ./neutral_paths.module
Responds to a command to reset taxonomy terms paths language.
neutral_paths_admin_submit_reset_user in ./neutral_paths.module
Responds to a command to reset user paths language.

File

./neutral_paths.module, line 209
Neutral paths.

Code

function _neutral_paths_set_all_to_neutral($type) {
  $num_updated = db_update('url_alias')
    ->fields(array(
    'language' => LANGUAGE_NONE,
  ))
    ->condition('language', LANGUAGE_NONE, '!=')
    ->condition('source', $type . '/%', 'LIKE')
    ->execute();
  if ($num_updated > 0) {
    drupal_set_message(t('@num aliases were reset to language neutral', array(
      '@num' => $num_updated,
    )));
  }
  else {
    drupal_set_message(t('No aliases were updated.') . $type);
  }
}