Last active
December 31, 2015 01:49
-
-
Save heddn/7916936 to your computer and use it in GitHub Desktop.
Entity Reference autocomplete FAPI example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $form['product_line_item_ref'] = array( | |
| '#type' => 'textfield', | |
| '#title' => t('Product Line Item Reference'), | |
| '#description' => t('Enter the product line item.'), | |
| // The last 4 URL parameters are important. | |
| // 4: Use <NULL> as a placeholder in the URL when we don't have an entity. | |
| // 3: Bundle, in our case the specific type of commerce line item but for node, that could page, etc. | |
| // 2: Entity type, commerce line item in our example but node is also a valid type. | |
| // 1: Field name that is the entityreference field. | |
| '#autocomplete_path' => 'entityreference/autocompelete/single/commerce_product_line_item_ref/commerce_line_item/related_lines/NULL', | |
| '#size' => 60, | |
| '#maxlength' => 255, | |
| '#required' => FALSE, | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment