class UCXF_AddressField in Extra Fields Checkout Pane 7
Same name and namespace in other branches
- 6.2 class/UCXF_AddressField.class.php \UCXF_AddressField
Class for a Extra Fields Pane Address field
Address fields are shown on checkout and on the order administration pages in the delivery and billing panes provided by Ubercart.
Hierarchy
- class \UCXF_Field
- class \UCXF_AddressField
Expanded class hierarchy of UCXF_AddressField
File
- class/
UCXF_AddressField.class.php, line 13 - Contains the UCXF_AddressField class.
View source
class UCXF_AddressField extends UCXF_Field {
// -----------------------------------------------------------------------------
// CONSTRUCT
// -----------------------------------------------------------------------------
/**
* UCXF_AddressField object constructor
* @access public
* @return void
*/
public function __construct() {
parent::__construct();
$this->returnpath = 'admin/store/settings/countries/fields';
$this->pane_types = array(
'extra_delivery',
'extra_billing',
);
}
// -----------------------------------------------------------------------------
// FORMS
// -----------------------------------------------------------------------------
/**
* Override of UCXF_Field::edit_form().
*
* Get the edit form for the item.
*
* @access public
* @return array
*/
public function edit_form() {
$form = parent::edit_form();
// Unset pane type field, the pane types asking is handled differently
unset($form['ucxf']['pane_type']);
// Unset also weight field, because the weight for an address field is implemented differently
unset($form['ucxf']['weight']);
// Add form element to ask in which panes they need to appear
$form['ucxf']['panes'] = array(
'#title' => t('Select the panes the field must get into'),
'#type' => 'checkboxes',
'#options' => array(
'extra_delivery' => t('Delivery pane'),
'extra_billing' => t('Billing pane'),
),
'#weight' => 5,
'#default_value' => $this->pane_types,
);
return $form;
}
/**
* Override of UCXF_Field::edit_form_submit().
*
* Submit the edit form for the item.
*
* @param array $form
* @param array $form_state
* @access public
* @return void
*/
public function edit_form_submit($form, &$form_state) {
$field = $form_state['values']['ucxf'];
// Check if user wants field in both delivery and billing pane
// only delivery pane = 'extra_delivery'
// only billing pane = 'extra_billing'
// both panes = 'extra_delivery|extra_billing'
foreach ($field['panes'] as $pane_type) {
if ($pane_type) {
$form_state['values']['ucxf']['pane_type'][$pane_type] = $pane_type;
}
}
parent::edit_form_submit($form, $form_state);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
UCXF_AddressField:: |
public | function |
Override of UCXF_Field::edit_form(). Overrides UCXF_Field:: |
|
UCXF_AddressField:: |
public | function |
Override of UCXF_Field::edit_form_submit(). Overrides UCXF_Field:: |
|
UCXF_AddressField:: |
public | function |
UCXF_AddressField object constructor
@access public Overrides UCXF_Field:: |
|
UCXF_Field:: |
private | property | An array of page names on which the field may be displayed @access private | |
UCXF_Field:: |
private | property | An array of pane types the field is in. @access private | |
UCXF_Field:: |
public | function | Delete the field from the database. @access public | |
UCXF_Field:: |
public | function | Validate the edit form for the item. | |
UCXF_Field:: |
function | Load an existing item from an array. @access public | ||
UCXF_Field:: |
public | function | generate() Generates a field array used in forms generated by uc_extra_fields_pane @access public | |
UCXF_Field:: |
public | function | Generates the value for use in fields. This value will be used as a default value for textfields and as an array of options for selection fields. | |
UCXF_Field:: |
public static | function | Returns an example for the value section | |
UCXF_Field:: |
public | function | Returns the "readable" value type, as a string. | |
UCXF_Field:: |
public | function | Returns if field is in given pane | |
UCXF_Field:: |
public | function | load() Loads field from database | |
UCXF_Field:: |
public | function | Returns if the field's value may be displayed on te given page. | |
UCXF_Field:: |
public | function | Output a value with filtering | |
UCXF_Field:: |
public | function | Output a value based on the field type | |
UCXF_Field:: |
public | function | save() Saves field in database @access public | |
UCXF_Field:: |
public | function | Return as an array of values. @access public | |
UCXF_Field:: |
constant | |||
UCXF_Field:: |
constant | |||
UCXF_Field:: |
constant | |||
UCXF_Field:: |
constant | |||
UCXF_Field:: |
constant | |||
UCXF_Field:: |
constant | |||
UCXF_Field:: |
public | function | Getter | |
UCXF_Field:: |
public | function | Setter |