Hi I was not sure where or how to add this but I needed this type of feature for a project I am currently working on so I went ahead and added in some new stuff so I figured I would post it here for your review.

Here is a break down as to what has been added:

Bundle Support
I added bundle support so that besides the Entity itself you now can add URL Aliases patterns individually to all Entity Bundles.

Entities Tab within URL Aliases Configuration
Your default implementation was to load all Entities on to the Pattern tab within the URL Aliases configuration page. That seemed a bit much and I really did not want to look at Entities I did not need so I added a new tab called Entities next to Patterns that allows you to choose which Entities you want to make available to Pathuto.

This will work in tangent with your hook you have implemented "hook_pathauto_entity_supported_entity_types".

Along with the Entities selection form I have added an hook_uninstall to remove any variables that form creates when the module is uninstalled.

Added in Bulk Support from pending patches as well as the Entity insert one
http://drupal.org/node/1407176
http://drupal.org/node/1540010

Bulk Delete Aliases
I also added in support to Delete Entity and Bundle Aliases in the "Delete Aliases" tab.

I also added an "Advanced Settings" fieldset under the Entities tab I created that allows you to expose all the entity bundles to the Delete Alias. The default is just to show the Entity Type

The reason for this is well in my case each of my bundles under my custom entity uses its bundle type as the first argument in the defaultUri settings and since the Delete Aliases works of the defaultUri to delete the aliases using just the Entity Type there does not work so you have to expose and the bundles individually to the Delete Aliases tab to be able to bulk delete aliases.

Node form type URL path settings now on Entity Forms
I added in the same type of custom override option for entities on the entity form just as you would see on a node form. This will allow users to add a custom or override a current url alias instead of just using the one pathauto generates or the defaultUri.

CommentFileSizeAuthor
#9 1947226-7199810-converted-zipped-files-to-patch.patch17.85 KBsolquimpo
#4 pathauto_entity.zip25.19 KBAnonymous (not verified)
#3 pathauto_entity.zip25.09 KBAnonymous (not verified)
#2 pathauto_entity.zip24.97 KBAnonymous (not verified)
pathauto_entity.zip23.95 KBAnonymous (not verified)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Status: Reviewed & tested by the community » Needs review

Sorry set the wrong status.

Anonymous’s picture

FileSize
24.97 KB

UPDATE
There was an issue with adding the url path settings for to the entity form. So I have created a hook to allow modules to define the entity and form id that the url path settings should be visible on.

I also added and pathauto_entity.api.php with the 2 current hooks.

Also there seems to be an issue with profile2 which i am looking into now. its not apply/creating the pathauto alias.

Anonymous’s picture

FileSize
25.09 KB

Profile2 now working.

Anonymous’s picture

FileSize
25.19 KB

Forgot to check if the initial variable was empty or not. Its now fixed.

jhoffmcd’s picture

Hi bpcarlsen,

This is a much needed feature, thank you for all your work on this! I am using RedHen CRM and I'm trying to get URL aliases to work with it's contact and organization entities. With your module they show up fine, in the Pathauto Patterns menu, but when I go to do a bulk update, the checkbox for the contact entity is not there, while the organization one is. Can you throw me in the right direction for why the module isn't picking up the RedHen contacts entities in the Bulk Update screen?

Anonymous’s picture

Hi jhoffmcd,

The only thing I can think of without looking at your code/configuration is that the contacts entities are not defined correctly. Or is it that the contacts entity is a bundle of organization? If that is the case then no it would not show up as it would bulk update the entire entity and all of its bundles.

Just to double check but the contacts entity is active on the entities configuration tab admin/config/search/path/entities correct? And it is not a bundle correct?

But like I said unless it has to do with how you defined your entities or that it is a bundle of organization then unless you can post or send me your code/module I can only speculate right now.

jhoffmcd’s picture

The odd thing is, I have two entities, Members and Productions. If I check both check-boxes under the Entities tab, only Productions show up in the Bulk Update tab. If I unchecked the Productions check-box, the Members show up, but I cannot get both at the same time. I'm not sure if this has to do with RedHen and they way they defines their Contact and Organization entities, but I was able to get this to work in the meantime by doing the Bulk Update separately.

mvdve’s picture

This is a great module. And thanks for the major update!
I have created a patch to include the language in pathauto_entity_update_alias().
This way, you can create a path for all the other languages when using entity translation.

See issue 2038001

It would be nice to have your major update and this small patch committed to this module!

solquimpo’s picture

Hi bpcarlsen,

Nice work. I have converted your updates from comment #4 to a patch that applies to the sanbox project (works nicely with git apply).

interdruper’s picture

Hi bpcarlsen,

Testing the last patched version (#29) of the sandbox, I have found the same strange error
that jhoffmcd reported in #7, that is, one entity always 'disappear' from Bulk Update list.

It is easy to reproduce: just create 2 dummy entities A and B using ECK UI,
with the default bundle (the same name). Select both in Pathauto Entity tab...
only the last will appear in the Bulk Update list.
If you un-check the last, then the first appears.

By the way, very useful code, +1 to get this promoted to a full project.

solquimpo’s picture

@interdruper: I'm guessing this is related to:

https://drupal.org/node/1946054

which seems to be related to:

https://drupal.org/node/1357792

interdruper’s picture

@solquimpo I have seen that with your help, possibly related EntityForm issue #1946054: Undefined index in _field_ui_bundle_admin_path() is now fixed. Any similar solution here ?

spessex’s picture

Hi

Can I confirm that the zipped files in #4 are exactly the same as applying patch #9 to the sandbox? I'm asking as I'm relatively new to Drupal, do not use Git, and always end up cocking up the patching, so was hoping I could just use the zipped files in #4?

I'm in the unfortunate situation where I have a very complicated site with over 200 modules that I've working on and off on for a period of time so in addition to the question above I also have two other queries which I'm hoping someone might be able to advise on.

1. Why would I have used this sandbox module? I have a feeling it might be something to do with Profile2, URL's or maybe changing entity data via a batch process through views. Can anyone enlighten me?

2. I originally came to this post as I was having problems uploading an image file to a premium drupal module called Mega Slider. It kept spitting out the following:

Notice: Undefined property: stdClass::$uri in file_save() (line 566 of /Applications/MAMP/htdocs/Linode/

Notice: Undefined property: stdClass::$uri in file_entity_file_presave() (line 14 of /Applications/MAMP/htdocs/Linode/MRFGR2_goodnex/sites/all/modules/file_entity/file_entity.file.inc).

Notice: Undefined property: stdClass::$uri in file_entity_file_update() (line 95 of /Applications/MAMP/htdocs/Linode/MRFGR2_goodnex/sites/all/modules/file_entity/file_entity.file.inc).

Notice: Undefined property: stdClass::$uri in file_move() (line 1010 of /Applications/MAMP/htdocs/Linode/MRFGR2_goodnex/includes/file.inc).

The specified file could not be copied, because no file by that name exists. Please check that you supplied the correct filename.

An error occurred and no file was uploaded.

Now that I have used - what I assume are is the whole patched module via the zip files in #4 - those errors have now disappeared but unfortunately the module can still not upload any images and instead just greys out the whole page and more or less freezes. Is there something else I might be missing?

Thank you

interdruper’s picture

Hi @spessex

Yes, #4 and #9 is the same code, the last one with a git patch format.

This sandbox makes sense to add Pathauto support for entities created programmatically, or using the ECK. You can select the entities to be enabled in Home » Administration » Configuration » Search and metadata » URL aliases » Entities Tab, and they will appear in Home » Administration » Configuration » Search and metadata » Patterns, where yo can define the desired aliases for them. If the Entities Tab does not appear, that means that the site has no additional entities defined, apart of the standard Content Types, Taxonomies, Comments and Users.

I do not know how it can be related to your problems with the theme, so I cannot help you in this. One research could be to find out if the theme creates and/or uses any new entity related with files, and check all the paths/aliases related. You may need to dive in the theme's hooks code for this.

maciej.zgadzaj’s picture

The issue mentioned in #7 and #10 is really caused by Pathauto module, and the way it generates Bulk Generate form - see #2124379: Bulk path generation types overwriting each other for custom entities.

I have added a kind of fix for this in my fork of this sandbox, not very nice though as it just overrides default Pathauto's form.

maciej.zgadzaj’s picture

Issue summary: View changes
Status: Needs review » Fixed

This has been merged into Pathauto Entity in my sandbox (a fork of this module).

Should we mark it as fixed here then?

Status: Fixed » Closed (fixed)

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