I found it easier to incorporate the funcionality of Text or Nodereference modul (http://drupal.org/project/text_noderef) into this module than port that to D7.
Patch coming in a minute.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

czigor’s picture

Status: Active » Needs review
FileSize
9.22 KB

In short: This patch ports the functionality of the D6-only module Text and Nodereference to Autocomplete Widgets.

In details:
If you choose the widget 'Autocomplete widget node reference' for a textfield, you can select the node types on the field setup. The node titles that belong to nodes of the selected node types will be offered for autocompletion options when filling out the textfield. However, a new value (that does not correspond to any node title) is also accepted. These values are also offered for autocompletion.

The patch also includes a field formatter (autocomplete widget node reference) that formats this field
1. as a link if it is true that the value of the textfield is the title of a node at display time
2. plain text otherwise.

czigor’s picture

If there are multiple nodes for a given title, the first one is used. Use the Unique field module to avoid confusion...

czigor’s picture

Sort the options.

bleen’s picture

Ill take a look at this in teh next week or so .. in the mean time can you post set of steps to test the functionality I should be seeing?

czigor’s picture

0. Apply the patch
1. Add a field with type 'Text' to an e.g. page node type
2. Choose the widget 'Autocomplete widget node reference'.
3. On the field settings page select the content types (e.g. Story) you wish to use the titles of for autocompletion.
4. On the Manage display page choose the 'Autocomplete widget node reference' format for this field.
5. Add some story contents
6. Add a page content to test the widget. The existing story nodes' titles are used for autocompletion and also additional existing field values that do not correspond to any story node titles. For example, you can type 'nosuchstory' to this field and the next time you add a page, this will also be used as autocomplete options.
7. Depending on whether the given value is a node title or not, the value is going to appear as a link to the node or just plain text.

bleen’s picture

Status: Needs review » Fixed
+++ b/autocomplete_widgets.moduleundefined
@@ -44,33 +44,41 @@ function autocomplete_widgets_views_api() {
+      'label' => t('Autocomplete for existing field data and some node titles'),

I really hate this label, but I have not been able to come up with a better one ...

Other than that, this is a great addition to the module so I've committed it: http://drupalcode.org/project/autocomplete_widgets.git/commit/d3084a9

Thanks czigor!

Status: Fixed » Closed (fixed)

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

Liaz’s picture

Hello,

I am not sure but I think I met a bug whith this feature when having multiple values.
I get an error message about
Undefined index: allowed_node_types in autocomplete_widgets_field_formatter_view()
I posted the detailed error message in the issue list of the module http://drupal.org/node/1519842#comment-5840532
My fault or a bug ?

Thanks anyway for working on this feature! it is great :)
Liaz.