This issue is similar to https://drupal.org/node/2220801 where I have trouble exporting url alias and pathauto settings when exporting node.

When I export node to feature, I was expecting the path and pathauto settings to also be exported along. This is not currently the case.

Attached is a patch that I wrote to patch this issue.

Feedback is greatly appreciated.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hckurniawan’s picture

hckurniawan’s picture

Status: Needs review » Needs work

Seems that url_alias is being duplicated when restoring feature. Marking this as "Needs work".

generalredneck’s picture

rabbitlair’s picture

The patch on #3 worked for me.

nvahalik’s picture

This patch is a good starting point, but needs some improvement on technical and formatting fronts.

The biggest problem is that it doesn't honor the value of $node->pathauto. It assumes that you want pathauto enabled, if you have the pathauto module installed and if the existing alias equals the alias that would be generated by the existing configuration. Therefore, if you happen to have the pathauto enabled but you've disabled it on the node being exported, then it could be enabled on the export. This could cause problems down the road.

Attached is a new patch that honors the setting of pathauto and fixes a couple of minor formatting issues.

Status: Needs review » Needs work

The last submitted patch, 5: 2220837-5-adding_path_pathauto.patch, failed testing.

nvahalik’s picture

Version: 7.x-1.0-alpha4 » 7.x-1.x-dev
Status: Needs work » Needs review

Setting to latest dev branch.

m.attar’s picture

I added a patch for module version alpha4 (adding_pathauto_alpha4_2220837-9)

Status: Needs review » Needs work

The last submitted patch, 9: adding_pathauto_alpha4_2220837-9.diff, failed testing.

m.attar’s picture

FileSize
1.01 KB
Shashwat Purav’s picture

Need help to preserve url aliases while exporting taxonomy terms using Features, UUID and UUID Features modules.

WorldFallz’s picture

Here's an updated patch against 7.x-1.x-dev that handles an undefined index notice as well as some code standard issues.

WorldFallz’s picture

Now with less unnecessary white space.

WorldFallz’s picture

Status: Needs work » Needs review
FileSize
1.14 KB

And the same patch for 7.x-1.0-alpha4 for convenience.

@Shashwat Purav: use one of these patches depending on the version of uuid_features you have installed to get this functionality.

Status: Needs review » Needs work

The last submitted patch, 15: adding_path_pathauto_alpha4-2220837-15.patch, failed testing.

gumanoed’s picture

I meet the same problem. When i export nodes to feature no path aliases are there :(

But patch #14 helped me!!!
You need this patch only on drupal from which you export nodes. Inport this feature with aliases works very well with standart feature_uuid module!

I made a little description of the procces of export nodes to feature with aliases (russian)
http://wiki.nntc.nnov.ru/index.php/%D0%9F%D1%80%D0%B8_%D1%8D%D0%BA%D1%81...

SocialNicheGuru’s picture

reroll for dev version 8/18/2016. The last one did not seem to apply to the dev version. I have done nothing else but re-roll to be included in my make file.

sumachaa’s picture

the patch is working when exporting the node, the 'features.uuid_node.inc' file is having

  'path' => array(
    'alias' => 'about',
  ),

But when importing this is not getting updated

munroe_richard’s picture

I'm running into the same issue with manually generated paths. When I have a node for which I've manually generated an alias, the alias doesn't show up in the ...uuid_node.inc file generated by features. The path should be: help/earnings/earnings-status. Here's the node as generated:

  'title' => 'Earnings Status',
  'log' => '',
  'status' => 1,
  'comment' => 2,
  'promote' => 0,
  'sticky' => 0,
  'type' => 'help_for_amds',
  'language' => 'und',
  'created' => 1474642553,
  'tnid' => 0,
  'translate' => 0,
  'uuid' => '6efca499-e03c-4081-b7f0-2b4f2bb66777',
  'body' => array(
    'und' => array(
      0 => array(
        'value' => 'Earnings status tells us if your earnings were used to pay Social Security FICA taxes.

If all your earnings had FICA withdrawn, click the Covered radio button and enter your earnings for the appropriate year.

If some of your earnings did not have FICA withdrawn, click the Partially Covered radio button and enter both earnings amounts for the appropriate year.

If none of your earnings had FICA withdrawn, click the Not Covered radio button and enter your earnings for the appropriate year.
',
        'summary' => '',
        'format' => 'filtered_html',
        'safe_summary' => '',
      ),
    ),
  ),
  'path' => array(
    'pathauto' => 0,
  ),
  'comment_count' => 0,
  'print_display' => 0,
  'print_display_comment' => 0,
  'print_display_urllist' => 0,
  'print_mail_display' => 0,
  'print_mail_display_comment' => 0,
  'print_mail_display_urllist' => 0,
  'pathauto_perform_alias' => FALSE,
  'date' => '2016-09-23 10:55:53 -0400',
  'user_uuid' => 'afa1e3f2-fd35-49c2-a8bc-4ed52bfffe60',

I'm using the module that was released in Aug-2016. When I looked at the code in node export render, I realized that the module wasn't actually doing anything with pathauto or the alias. I applied patch 18 and I'm seeing:

  'path' => array(
    'pathauto' => FALSE,
    'alias' => 'help/earnings/earnings-status',
  ),

in the rendered nodes which is promising. I'm going to see if things actually get the right paths when I enable the feature on another system.

And that worked as expected. The paths showed up and the manually generated path was correctly captured on the new system.

So I'm going with patch 18 until a new release of the dev module is made.

WorldFallz’s picture

Status: Needs work » Needs review
FileSize
1.11 KB

It would be really great if we could get this included in the next RC. Rerolled to get rid of a white space warning and kick testbot.

Status: Needs review » Needs work

The last submitted patch, 21: adding_path_pathauto-2220837-21.patch, failed testing.

m.lebedev’s picture

Status: Needs work » Needs review
FileSize
1.19 KB

Hello!
I think do not need to create an array that contains the original path of the node.

  // Add path and pathauto settings
  if (!property_exists($node, 'path')) {
    $node->path = array();
  } 

  $uri = entity_uri('node', $node);
  $path = drupal_get_path_alias($uri['path']);

  else {
    $node->path['alias'] = $path;
  }

I added a check that the path is not equal to the original.

adam3145’s picture

I have tried the patches in #21 and #18 with rc1, and neither of them are creating paths for taxonomy terms on export. Am I to use these patches on DEV or is something else going on? Using Drupal 7.54 with the RC1 release.

petednz’s picture

goron’s picture

The patch in #23 together with the patch at https://www.drupal.org/node/982818#comment-10040366 seem to provide the solution to exporting nodes successfully with alias (this patch) as well as rebuilding correctly on features revert (other issue's patch). Seems to me they should be combined and consolidated into one issue. Don't have time to do that myself at this moment, but thought it might be useful to someone else to know to use these patches together.

aubjr_drupal’s picture

@goron - Good idea. I've combined the two patches and am attaching it here.

UPDATE: Built the patch incorrectly. Re-uploading.

aubjr_drupal’s picture

Status: Needs review » Needs work

The last submitted patch, 28: uuid_node_save_path_alias-COMBINES-982818-2220837-28.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

aubjr_drupal’s picture

das-peter’s picture

Status: Needs work » Fixed

Looks good to me - Thanks :)
Committed & pushed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.