Hi,

in D6 you could use CCK field values/tokens to populate the title. This seems missing in the D7 port. I can't select any fields tokens. For example, a text field "subtitle".

Is there a solution?

CommentFileSizeAuthor
#4 references.patch1.15 KBfago
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gorillaz.f’s picture

Seems i made a mistake before.
After enable entity_token, there're field tokens in auto node title setting.
But not node/user reference token.

fago’s picture

Title: Fields tokens » support hook_entity_property_info()
Project: Automatic Nodetitles » References
Component: Code » Code: node_reference

We'll need to add support for the entity API's hook_entity_property_info() in the user/node reference fields.

fgm’s picture

This does not look like a core hook, but an extension provided by the contrib EntityAPI. Given the intentionally limited focus of this module as an interim solution to have something like D6 nodereference/userreference until something more complete and radically architected emerges, I'm inclined to only include support for core and views, not any additional contrib: new features should go into a more definitive solution.

Also, more specifically, References does not define any new entity, so it is a bit unclear why it should implement hooks on behalf of the user and node entities, which are already defined by core. Any detail ?

fago’s picture

Status: Active » Needs review
FileSize
1.15 KB

Yep, it's an entity API module hook - sry for not being clear on that. I've rolled a patch for it and attached it - it's quite simple.

Also, more specifically, References does not define any new entity, so it is a bit unclear why it should implement hooks on behalf of the user and node entities, which are already defined by core. Any detail ?

hook_entity_property_info() is supposed to be implemented by modules providing concrete entity properties or new field types in order to map the field types to a property type. With that mapping in place property info for each field instance is generated, such as rules or the search api can make use of it.

fago’s picture

Any update on this?
Would be awesome to get these two lines of code into the module, as they are required for being able to use the reference fieds with Rules.

das-peter’s picture

+1 for this. I patched it in my code to be able use references in rules and it works like a charm.
Thanks fago!

yched’s picture

Status: Needs review » Fixed

Looks like a no-brainer. Committed.
Thanks !

yched’s picture

It seems exposing this info causes major memory issues when Entity API is enabled: #1058912: Prevent recursive tokens.
I'm not reverting this yet, until we get other reports of the issue.

@fago : can you take a look ?

fonant’s picture

For some reason the 7.x-1.x-dev version [ user_reference.module,v 1.1.2.8 2011/02/15 ] of user_reference.module has

'property_type' => 'node'

when it should have

'property_type' => 'user'

Setting the value to "user" makes the Rules module's data selector work properly :)

Status: Fixed » Closed (fixed)

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

johnv’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Priority: Normal » Critical
Status: Closed (fixed) » Needs work

I'm reopening this issue, since I still encounter #1058912: Prevent recursive tokens, even with version 7.x-2.x-dev from 31march2011.
Reverting the 2 lines is the remedy. I only encounter the problem on 2 pages:
- admin/modules (don't know why it should appear there, are tokens used on this page?)
- admin/structure/types/manage/my_contenttype, when Automatic Nodetitles is enabled. With a small modification (see http://drupal.org/node/1068990#comment-4310800) in token.module, the auto-nodetitle fieldset shows what happens: with 70 tokens, every nodereference opens again 70 tokens, etc, exploding the memory usage.

As pointed out by Fonant, patch #4 is applied incorrectly. Correcting to 'property_type' => 'user' still leaves the memory exhaust. After removing the node_reference line, system works OK, but that's because I have no user-Fields.

yched’s picture

Committed a fix for the user_ref property type. Silly me.

johnv’s picture

yched, this patch causes #1058912: Prevent recursive tokens, which is critical for all Token-users.
wouldn't it be better to revert the patch, until the problem is fixed?

Shadlington’s picture

Subbing

aanjaneyam’s picture

With due respect to all I was of the view that the memory problem patch/fix be provided in the issue #1058912: Prevent recursive tokens. This would make it easier for users to search issue queue if they encounter the memory problem. Also it would be more relevant for the purpose for which issue #1058912: Prevent recursive tokens exists.

Cyberwolf’s picture

Subscribing.

HnLn’s picture

sub

pfrenssen’s picture

subscribe

aanjaneyam’s picture

Priority: Critical » Normal
Status: Needs work » Fixed

The correct thread to subscribe is #1058912: Prevent recursive tokens. The solution to memory exhaustion problem lies in a patch to token.

Status: Fixed » Closed (fixed)

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