I have created my own entites in a project. When i wanted to integrate with privatemsg I realized that it was no possible. How about offer the possibility of showing the "Send author a message" in all bundles, including custom entities created by the developer, not only in content types?

I could develop a path if you think it is interesting.

Thank you.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Enxebre’s picture

Status: Active » Patch (to be ported)
FileSize
6.59 KB

I have made a path for offer the possibility of choose any bundle existing in the site ( not only content types or comments). privatemsg can be selected as an own extrafield in display form for any view mode.

I hope it could be useful

Thank you.

Enxebre’s picture

Status: Patch (to be ported) » Needs review
Berdir’s picture

Please provide a unified diff, it looks like you have a git checkout, so all you need to do is git diff within the privatemsg directory.

The testbot is not going to like this patch.

Berdir’s picture

Version: 7.x-1.3 » 7.x-2.x-dev
Status: Needs review » Needs work
[08:07:07] Command [git apply --check -p1 /var/lib/drupaltestbot/sites/default/files/review/allbundles-1660876-1.patch 2>&1] succeeded.
[08:07:07] Command [git apply -v -p1 /var/lib/drupaltestbot/sites/default/files/review/allbundles-1660876-1.patch 2>&1] failed
  Duration 0 seconds
  Directory [/var/lib/drupaltestbot/sites/default/files/checkout/sites/default/modules/privatemsg]
  Status [1]
 Output: [error: No changes].
[08:07:07] Applied [allbundles-1660876-1.patch] to:
 > no files

Note that new features are only added to the 7.x-2.x branch.

Enxebre’s picture

Status: Needs work » Needs review
FileSize
4.08 KB

Ok.
I have made a new patch in the way you told me over the 7.x-2.x branch.

Thank you very much.

Status: Needs review » Needs work

The last submitted patch, allbundles-1660876-5.patch, failed testing.

Berdir’s picture

Looks interesting but there are quite some potential issues, some feedback:

- We should change the variable name and add a proper upgrade path from the old settings.
- Migration needs to include the show_on_comments settings, If enabled, all node types that are enabled should have the corresponding comment bundle enabled as well and then the show on comments setting can be removed as well. Users can then fine-tune those settings they way they want to.
- There is no requirement that bundle names are unique, so it is possible that you have e.g. a node and term bundle that's named the same way, probably needs a combined key of entity_type and bundle.
- There is no standard way of getting the uid of an entity. We might need to find a way to filter out those that we don't know it, not sure how yet. Maybe rely on entity propeties from the entity.module.
- Instead of $entity->title, you need to use the entity_label() function.
- Moving the links out of content['links'] is problematic, why is that necessary?

Enxebre’s picture

Status: Needs work » Needs review
FileSize
4.83 KB

hi Berdir!
I dont understand the second feeback. Do you want to say when somebody click on "show_on_comments" the comments bundles settings should be enabled too with a js or something like this. Tell me is that is correct please.

Names are composed now for entity and bundle name.

As you say there is no standar way of getting the uid of an entity, it could have no uid if the developer wants, so this is the most solid approach I have thinked. (you can see in the new patch)

entity_label() is used now

Links is ignored by display suite in nodes. Moving to an own container and exposing it in extrafields you have display suite integration for every bundle, for every views mode exisiting in the site, not only full or teaser, so you can put your privatemsg link where do you want through manage display ui.

You can see all this changes in this new path.

Thank you.

Status: Needs review » Needs work

The last submitted patch, allbundles-1660876-8.patch, failed testing.

Enxebre’s picture

Status: Needs work » Needs review
FileSize
4.86 KB

attach the path with a correction
waiting for your reply.

Thank you.

Berdir’s picture

Status: Needs review » Needs work

No, I'm saying that we don't need the comment setting anymore because you can now directly enable for which comment bundles you want to have it displayed. The setting isn't check anymore anyway. However, we want to migrate it by selecting the comment bundles as well for the

+++ b/privatemsg.moduleundefined
@@ -2347,40 +2347,46 @@ function privatemsg_build_modes($obj_type) {
+      'href' => $url . '/' . t('Message regarding @bundle', array('@bundle' =>  entity_label($bundle, $entity))),

The argument for entity_label() is the entity type, not the bundle.

The patch now adds a dependency on entity.module, we didn't have that before and that's probably why the tests explode.

Same for that links thing. Yes, it is nice to have DS integration,but your change would almos require DS, no? Because without it, the links aren't displayed within the links as they were before, right?

Enxebre’s picture

Status: Needs work » Needs review
FileSize
5.22 KB

I have changed the entity_label and I have added entity dependency.

DS dependencie are not really required, because we are adding the field with hook_field_extra_fields no with hook_ds_fields_info. Making it in this way we have the privatemsg option for every bundle we have selected in settings. Including when we are not using a custom ds layout or ds is disabled we have the possibility to choose privatemsg in manage display interface and display it.

Thank you.

Status: Needs review » Needs work

The last submitted patch, allbundles-1660876-12.patch, failed testing.

Enxebre’s picture

Note that you could remove as you say "Display links on comments of selected content types." and "Display link on teasers of the selected content types." could be removed too.

Enxebre’s picture

Status: Needs work » Needs review
ptmkenny’s picture

#12: allbundles-1660876-12.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, allbundles-1660876-12.patch, failed testing.

ivnish’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)
andypost’s picture

Status: Closed (outdated) » Needs work