Hello,
I installed and use the entity reference module on my site, as they say the node reference module "will most probably be deprecated in the near future in favor of Entity Reference"
Is there a chance that CCK signup could work with entity reference in the near/far future or isn't it going to happen ?
Thank you

Comments

Open Social’s picture

Hi, I noticed this is still the case.

Any plans to support entity_reference?

bsandor’s picture

Title: Entity Reference instead of Node reference » Entity Reference instead of Node Reference in D7
Category: feature » bug
Priority: Minor » Normal

I Opened this http://drupal.org/node/1924870 issue ( I marked that as duplicate in favour of this ticket).

Also I see some very practical things in it as Nodereference URL Widget is not compatible with OG 7.x-2.x http://drupal.org/node/1514180

Also I opened this http://drupal.org/node/1924984 ticket as of following mentioned incompatibility.

bsandor’s picture

Where to start?

If i'm right you can find following things related to nodereference url:

  1. nodereference_url: cck_signup.module / function cck_signup_node_view_alter
  2. node_reference: cck_signup.admin.inc / function _cck_signup_node_reference_fields, function _cck_signup_form_node_type_form_alter

I didnt have a look at the rest of sub modules as they are not the most important at this stage.(cck_signup.test is)

bsandor’s picture

Title: Entity Reference instead of Node Reference in D7 » Entity Reference instead of Node Reference in D7 (Entity Reference Prepopulate???)

Isn't it Entity Reference Prepopulate support that we are looking for? Which does the very same with entity references as nodereference_url_widget does with nodereferences?

bsandor’s picture

Title: Entity Reference instead of Node Reference in D7 (Entity Reference Prepopulate???) » Entity Reference instead of Node Reference in D7

Or Contextual Administration?

Some ideas here: http://drupal.org/node/1425864

bsandor’s picture

I started my simplified version: one signup and one event node type. It doesn't make sense to put it here as of code is pretty different. At the same time I put here those bits I needed the most time for.

1.

I found is that in .module in function cck_signup_get_signup:

->fieldCondition($field, 'nid', $event->nid)

needs to be changed to:

->fieldCondition($field, 'target_id', $event->nid)

as of Entity Reference Module.

2.

Also function cck_signup_node_view_alter is not necessary as of usage of Entity Reference Prepopulate to create links. It's not ready at all and dedicated to my own project. If you want to put links into link section use cck_signup_node_view_alter. I think it needs some change in logic as noderef_url will not generate the initial signup link. This function needs to take care of that.
Here are the lines creating my links:

$link = l (t ('Manage My Signup'), 'node/' . $signup->nid . '/edit', array ('query' => array ('destination' => 'node/' . $node->nid)));
$link = l (t ('Signup'), 'node/add/' . $custom_signup['signup_type'], array ('query' => array ($custom_signup['reference_field'] => $node->nid, 'destination' => 'node/' . $node->nid)));

Where $custom_signup is an array with 'signup_type' or 'reference_field' dedicated to my signup node type name and reference field (entity ref) on signup node type respectively.
$node is my event node.
$signup is: $signup = cck_signup_get_signup($node)
Naturally i set my entity_reference_field in signup to use entity reference functionality.

bsandor’s picture

Same in function _cck_signup_validate_signup_node:

if (!$event = node_load($values[$field_name][$language][0]['nid'])) {

needs to be changed to

if (!$event = node_load($values[$field_name][$language][0]['target_id'])) {