Closed (fixed)
Project:
Inline Entity Form
Version:
7.x-1.x-dev
Component:
Documentation
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
18 Sep 2012 at 13:34 UTC
Updated:
29 Aug 2016 at 02:38 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
tmsimont commentedI would also like this feature...
I was looking at the code in
CommerceProductInlineEntityFormController::entityForm()and I think the conflict might be coming from the fact that IEF lets you set up an automatic title with the "Auto generate the product title " on the field settings form.It looks like at some point it was adjusted to specifically react to the Title module...
I wonder how hard it would be to put in a similar replacement for the Automatic Entity Label...
Comment #2
tmsimont commentedThe attached patch will allow auto entity label to set and/or hide the title. Note that "Auto generate the product title " on the field settings form will have to be unchecked for this to work.
Comment #3
bennos commentedPatch from #2 works for commerce products.
Status set to RTBTC. One more review would be great.
But I think we need also support for entity's and nodes.
Comment #4
malberts commentedHere's a patch expanding #2 (support for Commerce Product) to also support Nodes. I'm not going to try this for Line Item/Term/Entity right now, but the code would be similar in all cases. I think we should expand this patch to get Automatic Entity Label support for all the core IEF Controllers before we commit this. Any thoughts?
Comment #5
malberts commentedSorry, I made a silly omission.
Comment #6
bennos commentedworks for core entity (nodes).
Comment #7
bojanz commentedI like this idea.
I'm going to investigate removing the custom IEF product title generation in favor of this integration.
The Title module specific code was made unnecessary by #1748008: Replaced fields should inherit the legacy field access and I'm going to remove it as soon as Title module gets a new alpha.
Comment #8
mrfelton commentedUpdated patch against latest dev.
Comment #9
froboyI'm testing the patch from #8 and it seems to work correctly, but has a small UI issue:
When adding a new node using the inline form, the title for the new node is not generated until the containing form is previewed or saved, which results in a blank title until that point as seen here:
.
This could be confusing to users.
In node.inline_entity_form.inc adding
auto_entitylabel_set_title($entity_form['#entity'], 'node');to the entityFormSubmit function seems to properly generate the title upon submission of the inline form, but I'm not sure if this is proper or where in the function it should go...Thoughts?
Comment #10
tmsimont commentedI'm not sure what the difference is but in the patch i wrote for commerce line items, the title there reads "Title will be automatically generated on submission" or something like that... I'm not sure what is different in the node entity handler that mrfelton patched
Comment #11
froboyIt seems like my proposed method (after the image in my post) could be better for both handlers as users would see a live preview of their node title. Would you be willing/able to integrate that into the commerce handler?
Comment #12
robin van emden commentedI encountered this issue as well - combining mrfeltons #8 patch combined with froboy's #9 suggestion worked perfectly.
No time to roll a patch adding #9 to #8 just now, very close deadline. Mrfeltons & froboy: thanks for your patches.
Tmsimont: #9 shows the auto title, indeed does seem more user friendly than "Title will be automatically generated on submission" - but maybe there's some disadvantage to #9 I am not immediately aware of?
Comment #13
geek-merlinit's only rtbc if we have a patch.
#9 must at least be wrapped in something like
Comment #14
froboyRolled both of our patches and the suggestion from #13 into one patch. I don't have anything set up to test the commerce side on and it looks a little more complicated, but this should do it for node titles.
Feel free to test, but this should probably still be "needs work" until someone can do the commerce side.
Comment #15
tmsimont commentedI don't think the commerce patch I used in #2 needs any more work. When I used it, I get a temporary title. I think commerce is doing something on its own to generate the temporary title.
Comment #16
froboyOkey, changing status. Who's going to test?
Comment #17
geek-merlin* code looks fine now
* has some trailing whitespace
* does what is says for nodes
did not test for products yet.
i think the code for nodes and products is cut-and-paste and should be factored out to a function.
this way integration of new entities will be simpler and easier to review.
so setting to needswork.
if someone(tm) tests the products integration feel free to rtbc and we might first fix this PITA and do the refactoring in a followup patch.
Comment #18
tmsimont commentedalex.rutz's comments applied to latest dev version in attached patch.
interdiff attached
Comment #19
tmsimont commentedproper interdiff, last one no good
please test
inline_entity_form-auto_entity_label-1787838-15.patchagainst latest dev branchComment #20
derekw commentedTested the patch. Had to manually apply the patch to node.inline_entity_form.inc for some reason.
Title/label does autogenerate, i.e. it works when adding nodes.
However if I then click Edit the node, Title field shows up.
Comment #21
tmsimont commentedMight that be an issue with Automatic Entity Label?
Comment #22
derekw commentedFirst guess -- it seems to be this code in includes/node.inline_entity_form.inc. If I take this out completely then the title is hidden and auto generates correctly on both new creation and edit. Maybe this is running after auto_entitylabel_form_alter, and overwriting the hidden, not required settings?
Comment #23
tmsimont commenteddang so its coming from IEF then -- I'm not familiar with the node controller in IEF.
Would wrapping that code in this work:
I'm not sure where you'd be able to set
$entityand$entity_typebut I bet the$entity_formvariable would at least have an#entityproperty.Comment #24
tmsimont commentedoops i meant to include NOT:
Comment #25
mtoscano commentedI tested patch #14 and #18: they both works hiding and autogenerating Title/label, but then adding a new node with a normal title, no Automatic Entity Label, via Inline Entity Form they both produce this error
Notice: Undefined property: stdClass::$nid in auto_entitylabel_set_title() (line 185 of /sites/all/modules/auto_entitylabel/auto_entitylabel.module).
and the title is replaced with the node type name.
Comment #26
alesr commentedI had the same issue from #25 and found a bug in the patch.
The problem was in entityFormSubmit() function because auto_entitylabel_set_title() was called every time, just by checking if module_exists('auto_entitylabel')
The solution is to add auto_entitylabel_is_needed() verification.
Patch is attached.
(Applied on patch #14, because #15 patch is not well constructed, but it can be easily applied on #15 too) by using those lines:
Comment #27
tmsimont commented#15 would work if you go #14, then interdiff.. or try just going straight into #15 -- there are differences there in 15 that are important.
Comment #28
alesr commentedNo problem. Here is the patch #28 with the fix applied on patch #15.
Comment #29
dave reidActually I propose an alternative that doesn't require making any changes to IEF. If entity_autolabel uses hook_field_attach_form() to do it's title processing, then it just *works* with IEF and all possible entity types. I propose we mark this as a duplicate of #1980652: Make auto_entitylabel work with inline_entity_form widget.
Comment #30
Gaelan commented#1980652: Make auto_entitylabel work with inline_entity_form widget was fixed.
Comment #31
martin74 commentedAfter the patch (28) my commerce kickstart is still not generating auto title's
its a basic installation, with addittional catergories and collections ,translating to dutch
Comment #32
dave reid@Martin_S: Rather than trying the patch here, can you test if using the most recent dev version of auto_entitylabel on your site makes this work for you?
Comment #33
lehmanshaunc commentedI just tested this with the 7.x-1.x-dev version dated 2013-May-05 and it worked!
The Node Title was set to the Node ID on the first save.
Comment #34
martin74 commented@ Dave Reid
tnx for the reply , doing that now!
Edit
@ Dave Reid , you made my day.. works great!
Comment #35
martin74 commentedA bit to early cheering.. i get errors on new products ( the name changed item work fine )
Notice: Undefined index: nl in auto_entitylabel_set_title() (regel 246 van /var/www/vhosts/xxx/httpdocs/sites/all/modules/auto_entitylabel/auto_entitylabel.module).
Comment #36
johnstav commentedEntity label appears as %AutoEntityLabel% when:
- Add an entity via the inline entity widget
- Save the added entity
- Don't save the parent entity
- Edit the added entity
- Save the added entity again.
Comment #37
martin74 commentedit doesnt store my auto title in one time if i use the product title in the entity
i need to open the product a 2th time and store the variation and product again.
Comment #38
dave reidThis does need another patch to the auto_entitylabel module to set the label in hook_field_attach_submit(). I've submitted a patch here: https://drupal.org/node/1980652#comment-7609069
Comment #39
roam2345 commentedRerolled patch does not apply to 7.x-1.x.
Comment #40
roam2345 commentedmissed patch here it is.
Comment #41
vasikeas Dave Reid said on #38, this was fixed in Automatic Entity Label - #1980652-7: Make auto_entitylabel work with inline_entity_form widget.
my tests confirm that with the last dev of Automatic Entity Label, there's nothing to be done here.
Except the documentation - at least to specify on project page that IEF works with Automatic Entity Label.
Comment #42
davewilly commentedRemove
Comment #43
bojanz commentedThe issue is open, so it hasn't been solved obviously.
Comment #44
milos.kroulik commentedI have tested IEF 1.5 with AEL 1.x-dev and can confirm, that it works as expected. I don't see any work left, that should be done here.
Comment #45
bojanz commentedOkay, then.
Opened #2181441: Remove product title autogeneration as a followup.
Comment #47
ayalas commentedFrom my tests the switch to the Automatic Entity Label module does not resolve #2212861: title autogenerate doesn't always copy updated parent entity title to child commerce products.
Comment #48
thomasmurphy commentedI've just tested this against the full release and the dev version and it hasn't fixed this issue (core 7.50 / inline_entity_form 1.8 / auto_entitylabel 1.3) ...ah, but (core 7.50 / inline_entity_form 1.8 / auto_entitylabel 1.x-dev) works fine. Just posting this to save people a bit of time.