Active
Project:
Entity API
Version:
7.x-1.x-dev
Component:
Code - misc
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
18 Feb 2012 at 05:33 UTC
Updated:
18 Jul 2012 at 07:56 UTC
For the Automatic Entity Label project it would be useful to know the following bits of information about entities:
Is the entity api the right place for discussing the possibility of adding such information to entity info?
Comments
Comment #1
bojanz commented#1196456: provide a harmonized entity_form() function should solve some of your questions.
Comment #2
bforchhammer commentedI am sorry, but I don't understand how that helps... would you mind elaborating?
For clarification: I'm looking for a way to be able to modify existing forms... i.e. my idea was to implement
hook_form_alter()and use the form id to check whether a form is one that I would like to adjust. E.g. for bundle edit forms, the form ids would be:node_type_formnode_type_formtaxonomy_form_vocabularyprofile2_type_formThere doesn't seem to be a consistent pattern here, especially with things like node+comment configuration using the same form. Also, I'd not only like to know if a form belongs to the class of "bundle edit forms", but also which entities/bundles it's for, i.e. in the case of node_type_form I'd want to know that it is responsible for configuration of both comment and nodetype entities.
I could of course just hard-code some of these ids, but where's the fun in that? (Also, maybe the mapping of
entity-type + bundle --> form idcould be useful to other developers as well) ;-)Sorry, if this is already possible and I just haven't figured it out...
Comment #3
fmizzell commentedThis is the piece of code from the issue bojanz pointed out.
As you can see this entity_form function is looking for a 'form callback' key in the entity_info array. This info will help you with entity forms, but not with the other two cases:
I guess following the pattern set up by that issue there should also be a 'form callback' at $entity_info[$entity_type]['bundles'][$bundle] to cover the second case.
For the first case, have you ran into any of these? Which module have forms that are exclusively for an entity_type+bundle pair.. I don't believe core has any of those.
not sure where the node+comment info needs to be added.
Comment #4
bforchhammer commentedI still don't see how exactly. The
form callbackis not the same as the form id, i.e. this will not help me withhook_form_alter()as far as I can see.entity_form()also doesn't provide any other means for altering a form...Comment #5
fmizzell commentedThat's true... well, I guess "form id" is needed in the info array too
Comment #6
bforchhammer commentedRelated issue for identifying "entity forms": #1608838: Identifying entity edit forms