Comments

vasike’s picture

Status: Active » Needs review
StatusFileSize
new8.81 KB

i build a patch for this.
to accomplish this i had to define a new Taxonomy widget. For now it is based on the taxonomy term autocomplete widget form.
it still needs work, but i think can be a first step. feedback welcomed

andypost’s picture

working re-roll, require view to allow search work
has wrong selecting of field in view if there's a entityreference field in same bundle

andypost’s picture

andypost’s picture

StatusFileSize
new8.14 KB

Patch fixes some code comments and adds actual vocabulary name after create button

kbasarab’s picture

Status: Needs review » Needs work
StatusFileSize
new10.44 KB
+++ b/references_dialog.dialog_widgets.incundefined
@@ -75,6 +96,50 @@ function references_dialog_references_dialog_widgets() {
+    if (user_access('administer taxonomy')) {
+      return array(
+        array(
+          'title' => t('Edit'),
+          'href' => taxonomy_term_uri($term) . '/edit'
+        ),
+      );

I had to change this so as taxonomy_term_uri returns an array containing a path key:

$path = taxonomy_term_uri($term);
$path = $path['path'];

Other thing I found is that when a term is saved it shows just the TID in the autocomplete field the next time you edit. See screenshot attached.

andypost’s picture

Strange, it work for me

brankoc’s picture

After applying the patch from comment 4, I get something similar as kbasarab. After saving my node and returning to the Edit view, the contents of the term reference fields have been replaced by numbers.

If I then click the Edit dialog button, I get a dialog with the following text:

Edit

The requested page "/drupal7/Array/edit?render=references-dialog" could not be found.

('/drupal7' is the name of my installation.)

Applying kbasarab's fix makes the Edit dialog work.

According to the API, taxonomy_term_uri() always returns an array with a single item with the key 'path': http://api.drupal.org/api/drupal/modules!taxonomy!taxonomy.module/functi...

kbasarab’s picture

Status: Needs work » Needs review
StatusFileSize
new2.14 KB
new8.57 KB

Lets try this one out. This starts with #4 then fixes path as I found in #5. The term id as the defualt value is also addressed.

Interdiff is between 4 and 8.

kaizerking’s picture

#kbasarab do we need to apply both? i,e the patch and interdiff.text?

kbasarab’s picture

Interdiff strictly shows the changes that I made to #4. All you need to apply is #8.

andypost’s picture

Status: Needs review » Needs work

@kbasarab is there any reason to display [tid] in field? Core does not do that.

Also

+++ b/references_dialog.dialog_widgets.inc
@@ -75,6 +96,60 @@ function references_dialog_references_dialog_widgets() {
+    }
+    if (user_access('administer taxonomy')) {
+    $path = taxonomy_term_uri($term);
+    $path = $path['path'];
+    return array(
+        array(
+          'title' => t('Edit'),

The code-indent is wrong

kbasarab’s picture

For the TID in the input type I was building off of code that was already in the project to supporting that but it wasn't showing. In addition it was based off of how node reference fields work allowing the edit link to show based on the term ID. I think my thought behind this was to avoid an extra term lookup.

I'll take care of that code indent. Want to decide what to do with the TID portion first though and integrate all of them together.

andypost’s picture

TID is never stored in taxonomy auto-complete so providing it will break core's behavior...
Take a look at core's implementation in taxonomy_autocomplete_validate()

vasike’s picture

v2 of Taxonomy Term Reference Filter by Views aims to integrate with References dialog for Term reference.

i think i used the patch #4 for working on this integration.

andypost’s picture

Status: Needs work » Needs review
StatusFileSize
new2.88 KB

Looks like we could have simpler implementation for taxonomy.
The $element['#entity'] already have tid tid so no reason in new widget

andypost’s picture

Status: Needs review » Needs work

I will re-roll the patch letter with hunk to fix settings.
Also the way of attaching reference widget should be refactored to make this work. Currently module uses hook_element_info_alter() to attach references_dialog_process_widget() to each element that have #entity_type key in element array. This bring a lot of overhead and should be replaced with hook_field_widget_form_alter() introduced in drupal 7.8 but this require maintainer attention to this.

+++ b/references_dialog.moduleundefined
@@ -249,7 +249,11 @@ function references_dialog_form_field_ui_field_edit_form_alter(&$form, $form_sta
-    $form['instance']['widget']['settings'] += references_dialog_settings_form($field, $instance);
+    if (isset($form['instance']['widget']['settings'])) {
+      $form['instance']['widget']['settings'] += references_dialog_settings_form($field, $instance);
+    } else {
+      $form['instance']['widget']['settings'] = references_dialog_settings_form($field, $instance);

This hunk still needed to patch work

andypost’s picture

Status: Needs work » Needs review
StatusFileSize
new8.25 KB

@kbasarab This patch get's tid from $element and only hunk for custom widget uses searching for [tid:N]
Actually I'd prefer to drop custom widget and move to hook_field_widget_form_alter() implementation but the patch still uses old behavior to keep BC

vasike’s picture

i tried the last patch (#17) and it did work for me.

keti-1931’s picture

thanks a ton andypost patch #17 works for me great!!

kbasarab’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/references_dialog.dialog_widgets.incundefined
@@ -326,3 +347,48 @@ function references_dialog_entityreference_views_query($view, $instance, $field)
+    $add_links[] = array(
+      'title' => t('Create @type', array('@type' => strtoupper($field['settings']['allowed_values'][0]['vocabulary']))),
+      'href' => 'admin/structure/taxonomy/' . $field['settings']['allowed_values'][0]['vocabulary'] . '/add',
+    );
+  }
+  return $add_links;
+}

I'm not sure we want to make the assumption we want these are uppercase. But I don't think this is a stopping point for this patch. Marking as RTBC.

  • rogical committed 90bdcfe on 7.x-1.x authored by andypost
    Issue #1429288 by vasike: References dialog for Term reference
    
rogical’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

caschbre’s picture

I noticed that the dialog options only appear when using autocomplete... however it doesn't appear when using autocomplete (Tags style). Is that the expected behavior?

maximpodorov’s picture

In references_dialog_term_reference_autocomplete_validate(), the following line is incorrect:
$value = array();
This should be used instead:
$value = NULL;

les lim’s picture

Category: Feature request » Bug report
Status: Closed (fixed) » Needs review
StatusFileSize
new623 bytes

Follow-up patch for #25.

alhambra’s picture

Issue summary: View changes
StatusFileSize
new1.39 KB
new804 bytes

Thanks for the patches! Patch #26 works for me.

I changed the output of the 'create xx' link a bit:

  • switched from machine_name to name. I believe this is more end-user friendly.
  • removed the uppercase feature. This can be achieved through CSS.
alhambra’s picture

Cogax’s picture

StatusFileSize
new1.8 KB
new619 bytes

I had the following problem:
I have an vocabulary "categories" with an term "Events". I have a multilingual site, so i translated this term in german. In german it's also called "Events". So when i referenced that term in a german node, it takes the englisch term.

The followin patch fixes that by simply change the format like it is for node references.

  • jmelnik committed eff3caa on 7.x-1.x authored by alhambra
    Issue #1429288 Followup: by alhambra, Cogax, Les Lim, maximpodorov:...
WorldFallz’s picture

Status: Needs review » Fixed

committed the patch from #27. I don't have the ability to test the multi-language patch from number 29.

In any case, please open follow-up issues for anything else related to the term reference integration (including the multi language issue from 29).

Status: Fixed » Closed (fixed)

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