Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#3 | 1422672-3-text-and-noderef.patch | 9.27 KB | czigor |
#1 | 1422672-1-text-and-noderef.patch | 9.22 KB | czigor |
Comments
Comment #1
czigor CreditAttribution: czigor commentedIn 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.
Comment #2
czigor CreditAttribution: czigor commentedIf there are multiple nodes for a given title, the first one is used. Use the Unique field module to avoid confusion...
Comment #3
czigor CreditAttribution: czigor commentedSort the options.
Comment #4
bleen CreditAttribution: bleen commentedIll 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?
Comment #5
czigor CreditAttribution: czigor commented0. 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.
Comment #6
bleen CreditAttribution: bleen commentedI 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!
Comment #8
Liaz CreditAttribution: Liaz commentedHello,
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.