function _webform_render_productfield in Commerce Webform 8
Same name and namespace in other branches
- 7.2 productfield.inc \_webform_render_productfield()
- 7 productfield.inc \_webform_render_productfield()
Implements _webform_render_component().
File
- ./
productfield.inc, line 152
Code
function _webform_render_productfield($component, $value = NULL, $filter = TRUE) {
$node = isset($component['nid']) ? node_load($component['nid']) : NULL;
$product_ids = _webform_productfield_product_ids($component);
return array(
'#type' => 'webform_productfield',
'#choose_quantity' => !empty($component['extra']['choose_quantity']),
'#multiple' => !empty($component['extra']['multiple']),
'#productids' => $product_ids,
'#required' => !empty($component['required']),
'#default_value' => isset($value) ? $value : _webform_filter_values($component['value'], NULL, NULL, NULL, FALSE),
'#weight' => $component['weight'],
'#aslist' => !empty($component['extra']['aslist']),
'#name' => $filter ? _webform_filter_xss($component['name']) : $component['name'],
'#description' => $filter ? _webform_filter_descriptions($component['extra']['description'], $node) : $component['extra']['description'],
'#title_display' => $component['extra']['title_display'],
'#theme_wrappers' => array(
'webform_element',
),
'#attached' => array(
'js' => array(
drupal_get_path('module', 'commerce_webform') . '/commerce_webform.js',
),
),
);
}