Issue #2887930 by mbreden: Add logic and UX to let the customer choos… - #6
Issue #2887930 by mbreden: Add logic and UX to let the customer choos…#6MattBred wants to merge 2 commits into
Conversation
…e which product reference field to use
| * | ||
| * @return bool | ||
| * TRUE if the node has a product reference field. | ||
| * FALSE if the node does not have a product reference field. |
There was a problem hiding this comment.
I think it's safe to assume that people know a boolean is true or false and this could just say it's true if there's a reference field.
This could also say "node type" since it's checking the bundle, not an actual node.
| '#title' => t('Display Type'), | ||
| '#type' => 'select', | ||
| '#description' => t('Select the display (node) type to use in import.'), | ||
| '#description' => t('Select the display (node) type to use in import. (The node must have a product reference field to show up in this list.)'), |
There was a problem hiding this comment.
You don't need parentheses here. Just say "The node must have..." or "Only nodes with product references are listed".
| return array( | ||
| '#title' => t('Product Reference Field'), | ||
| '#type' => 'select', | ||
| '#description' => t('Select the product reference field to use in import.'), |
There was a problem hiding this comment.
"to use in import" isn't very clear about what happens with it unless you know how the import works under the hood. Can we say that it's the field that has the product variations?
| // Only grab node types that have a reference to a product. | ||
| $node_types = array_filter(node_type_get_types(), function ($node_type) { | ||
| return commerce_xls_import_product_reference_field_exists($node_type->type); | ||
| }); |
There was a problem hiding this comment.
This is the same code as in the import_start function. Should there be a function for it instead?
There was a problem hiding this comment.
Drupal standards question: If there's a function that only an admin form(s) will use, where should it go? In this example, when the commerce_xls_import.export.inc file is running, the commerce_xls_import.admin.inc file isn't included, so we can't put the function there without doing an ugly drupal include thing.
…o a single function
…e which product reference field to use