I am trying to figure out how nodes are mapped back to the fields they contain for learning purposes. How is this done?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In Drupal 7 you have entities and fields; fields are attached to entities. A node is an implementation of an entity (the node module implements
hook_entity_info()and other such hooks) so it can have fields.All field/entity relational data is stored in the tables
field_data_field_xandfield_revision_field_xor similar (the latter potentially storing revisions of field data if node revisions are enabled).The
entity_idcolumn in those tables is the node’s ID, and thebundleis the node’s content type. Therevision_idis the revision ID of the node, again only really useful if node revisions are enabled.UPDATE
In Drupal terminology a content type is a
bundleandbundles are attached to entities (in this case thenodeentity). When you create a new content type it gets stored in thenode_typetable, and when the caches are cleared (which invokeshook_entity_infoon all modules) thenode_entity_info()function builds up a list of bundles from the content types (have a look at the bit in that function that startsforeach (node_type_get_names() as $type => $name) {,node_type_get_namesgets a list of all content types).As discussed above fields can be attached to entities, so fields can be attached to nodes with a delta (if you like) of
bundle.