Needs work
Project:
Title
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Jun 2013 at 19:20 UTC
Updated:
11 Apr 2019 at 06:12 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
bojanz commentedIt's a bit hacky, but it's the best I could think of.
This allows taxonomy term references to be used as Commerce attributes on the add to cart form, and the node add / edit form.
Comment #2
plachOverall looks good to me, thanks, a couple of remarks:
PHP docs are not wrapping correctly at column 80.
Why can't we use field_update_field() here?
Why this isn't causing recursion? ;)
Comment #3
bojanz commentedI intentionally tried to avoid using field_update_field(), in order to avoid refiring all the hooks for the save.
The recursion doesn't happen because in the second run $field['settings']['options_list_callback'] is not empty anymore.
I'll do a new round of work on the patch.
Comment #4
plachNevermind, I'll fix those on commit :)
Comment #5
bojanz commentedOkay, figured out why drupal_write_record didn't work inside title_field_update_field, because field_update_field places a copy of the data inside $field['data'].
Now fixed, so both hooks match.
Comment #6
plachThanks!
Reminder for me: this still needs comment fixing ;)
Comment #7
bojanz commentedThat's odd because for me the comments wrap just fine, before line 80.
Comment #8
plachYep, but they should wrap as close to column 80 as possible :)
Comment #9
bojanz commentedAh, okay, I misunderstood.
Comment #10
bojanz commentedQuestion: What should we do with taxonomy term references created before Title was installed?
Should we have an install hook?
Update function?
Batch somewhere?
Feels clumsy to just tell people to resave all of their fields manually.
Comment #11
plachWell, an update function sounds as the way to go, but it's the kind of stuff that usually leads to unpredictable failures. Since we are still in alpha stage and the upgrade path is best-effort level, I might be ok with this fully working only on new installations.
Comment #12
bojanz commentedSo, a hook_install then?
This might need a batch though...
(Or we can do it by best effort and only process the first 20 or so, dunno)
Comment #13
plachYep,
hook_install()+ batch sounds the right way...Comment #14
muschpusch commentedI would like to use this patch but will it work when title is already installed?
Comment #15
bojanz commentedYes, but you need to resave your taxonomy term reference field (click edit in "Manage fields", and submit the form).
Comment #16
vasikei did some work on the last patch trying to include also in the install and update scripts.
check the patch attached.
i'm not sure about taxonomy term reference fields Features built/defined.
probably they need the new setting to be present in feature definition.
Comment #17
Stevel commentedDoesn't it make more sense to fix this in the taxonomy_term_reference field to properly load the entity? That would also help for things like field translation etc.
Comment #18
mibfire commentedThese patches dont work with dev version of title module:
PHP Fatal error: Cannot redeclare title_taxonomy_allowed_values() (previously declared in /title.module:139) in /title.module on line 1062
Comment #19
mibfire commentedSomething strange is happening here. I applied the patch(2013985-fix-taxonomy-terms-16.patch), ran the update, and now i cant translate or delete my terms! I can create new one and translate it.
Take a look at the images what i attached here: terms-in-hungarian-lang.png, term-page.png
If something isnt clear or i should provide more info, just let me know, thx!
Comment #20
mibfire commentedbojanz,
And you have to disable the i18n_taxonomy(Taxonomy translation) module!
Comment #21
mibfire commentedI realized that i cant use taxonoy menu module if i18n taxonomy is disabled(it could be used if i set the menu to "localize and translate", but there is an issue, cos in this case the taxonomy menu if i check the rebuild option and save the vocabulary the translated terms wont be associated to the source menu item, so only the source lang of the terms will be built as menu items)
I had to fix this in title module: When i18n taxonomy is enabled the "title_taxonomy_term_reference_field_options_list_callback" can happen only when empty($field['settings']['options_list_callback'] is empty, but this wont be empty cos i18n_taxonomy will set it when it is enabled by using "i18n_taxonomy_modules_enabled", so i have to check if taxonomy term is enabled in entity translation, and if yes we must set "title_taxonomy_allowed_values" to options_list_callback. I added the title_modules_enabled function too where title_taxonomy_allowed_values is added to options_list_callback as well.
There is a hook_field_storage_details_alter function in i18n_taxonomy which prevents title to work as was intended, so i had to add this function to title module as well and modify title_module_implements_alter to run after i18n_taxonomy.
Comment #22
mibfire commentedI created a patch for the above fix.
Comment #24
zekvyrin commentedpeople, can you try dev version, which includes patchfrom #1920096: Title incompatibility with the entity reference widget ?
Part of #22 patch is included ('title_taxonomy_allowed_values' function) and might help you pass tests.
Comment #25
thepanz commented--removed--
Comment #27
thepanz commentedComment #28
joelpittetLet's see if testbot agrees.
Comment #29
thepanz commentedWe're using patch in #27 intensively and it is working great!
please merge this patch :)
Comment #30
betz commentedRerolled to latest dev.
Comment #31
betz commentedback to review
Comment #32
itamair commentedThe #30 worked for me, but just after disabling (and uninstalling) the Taxonomy translation (i18n_taxonomy) module
Comment #33
pifagor