function uc_usps_form_node_form_alter in Ubercart 8.4
Implements hook_form_BASE_FORM_ID_alter() for node_form().
Adds package type to products.
See also
uc_product_form()
File
- shipping/
uc_usps/ uc_usps.module, line 34 - United States Postal Service (USPS) shipping quote module.
Code
function uc_usps_form_node_form_alter(&$form, &$form_state, $form_id) {
$node = $form_state
->getFormObject()
->getEntity();
if (uc_product_is_product($node
->bundle())) {
$form['shipping']['usps'] = [
'#type' => 'details',
'#title' => t('USPS product description'),
'#tree' => TRUE,
];
$form['shipping']['usps']['container'] = [
'#type' => 'select',
'#title' => t('Package type'),
'#options' => USPSUtilities::packageTypes(),
'#default_value' => isset($node->usps['container']) ? $node->usps['container'] : 'VARIABLE',
];
}
}