function paymentreference_field_widget_form in Payment 7
Implements hook_field_widget_form().
File
- modules/
paymentreference/ paymentreference.module, line 178 - Hook implementations and general functions.
Code
function paymentreference_field_widget_form(array &$form, array &$form_state, array $field, array $instance, $langcode, array $items, $delta, array $element) {
global $user;
if ($instance['widget']['type'] == 'paymentreference') {
$line_items = array(
new PaymentLineItem(array(
'amount' => $instance['settings']['amount'],
'description' => $instance['settings']['description'],
'name' => 'paymentreference',
)),
);
$element['pid'] = array(
'#type' => 'paymentreference',
'#default_value' => isset($items[$delta]) ? $items[$delta]['pid'] : 0,
'#required' => $instance['required'],
'#payment_line_items' => $line_items,
'#payment_currency_code' => $instance['settings']['currency_code'],
'#payment_add_page_path' => 'paymentreference/pay/' . $instance['entity_type'] . '/' . $instance['bundle'] . '/' . $instance['field_name'],
'#payment_load_callback' => 'paymentreference_load',
'#payment_load_arguments' => array(
$instance['entity_type'],
$instance['bundle'],
$instance['field_name'],
$user->uid,
),
) + $element;
}
return $element;
}