Fago: Also, it would be nice if it could cover profile2 too, which is already prepared for something like that (and offers this functionality currently via Rules only).

Comments

bforchhammer’s picture

Status: Active » Postponed (maintainer needs more info)

I'm actually not sure what this might look like for profile2...

bforchhammer’s picture

Status: Postponed (maintainer needs more info) » Active

Okay, I found https://drupal.org/node/1392716 for reference.

Automatic Label is already possible with profile2:

  1. Setup Autolabel on admin/structure/profiles/manage/main/auto_label
  2. Choose "Automatically generate the title and hide the title field" and enter a pattern
  3. Edit a profile and marvel at your automatic label :)

The 3rd option "Generate the title if the title field is left empty" on the autolabel settings page does not make much sense for profile2 types, as the label is never displayed on any form, and always prefilled with the name of the profile type... So I guess the options on the form need to cleaned up depending on whether the label is visible or not.

bforchhammer’s picture

Status: Active » Postponed

9ac70f3 adjusts the autolabel options for profile2 entities and removes the "Hide label" option.

This is hard-coded for profile2 at the moment; a proper solution would be to add a respective parameter to the entity info array and load it from there, so that modules can specify this themselves.

bforchhammer’s picture

Version: » 7.x-1.x-dev

See #1444872: Add entity info about forms and entity label for discussion on adding things to the entity info array.

timwood’s picture

bforchhammer,
I'm trying to do what you describe in #2 above, but I don't see any tokens available from the profile entity I'm working on. Only tokens sections available are:

current date
current page
current user
random
site information

I'd expect there to be a "profile2" set of tokens with all the fields I've added. Do you know why I'm not seeing any? Automatic profile label is much less useful if you cannot use tokens from profile2 fields.

I have entity_token module enabled.

Also, how does Auto entity label know which field to use as label? Profile2 doesn't seem to come with a default "label" field like Taxonomy, Node and other entities do.

Thanks!

bforchhammer’s picture

I'd expect there to be a "profile2" set of tokens with all the fields I've added. Do you know why I'm not seeing any? Automatic profile label is much less useful if you cannot use tokens from profile2 fields.

You're right, that does seem to be broken. This was working when I tested it a year ago, so something must have changed since then... I'll see what I can do.

EDIT: Hold on, this is still working. I forgot to enable the entity_token module before... I'm now using the latest recommended versions of all modules involved (token, entity, profile2), and I get 6 token categories including one named "Profile" which lists tokens for profile2 fields. I am not sure why you wouldn't; do you have any other modules installed which might be messing with tokens?

Also, how does Auto entity label know which field to use as label? Profile2 doesn't seem to come with a default "label" field like Taxonomy, Node and other entities do.

It should use the "label property" which was added in #1338968: Use tokens in profile type label; fairly similar to the node title, but for some reason it's not shown on the form or in the fields-list...

  • bforchhammer committed 9ac70f3 on 8.x-1.x
    Issue #1437534 by bforchhammer: Added Support profile2.
    
    

  • bforchhammer committed 9ac70f3 on 8.x-2.x
    Issue #1437534 by bforchhammer: Added Support profile2.
    
    
vladimiraus’s picture

Issue summary: View changes
Status: Postponed » Fixed

Status: Fixed » Closed (fixed)

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