Skip to content
This repository was archived by the owner on Nov 6, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions addons/field-mobile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/**
* Mobile Field Addon for CampTix
*
* A few of the payment platforms require the mobile/phone field to complete the
* transaction. By adding it as a field, the payment class can explicitly call this
* field type to pass the variable to the payment platform.
*
*/
class CampTix_Addon_Mobile_Field extends CampTix_Addon {

/**
* Register hook callbacks
*/
function camptix_init() {
add_filter( 'camptix_question_field_types', array( $this, 'question_field_types' ) );
add_action( 'camptix_question_field_mobile', array( $this, 'question_field_mobile' ), 10, 3 );
}

/**
* Add Country to the list of question types.
*
* @param array $types
*
* @return array
*/
function question_field_types( $types ) {
return array_merge( $types, array(
'mobile' => 'Mobile',
) );
}

/**
* A url input for a question.
*/
function question_field_mobile( $name, $value ) {
?>
<input name="<?php echo esc_attr( $name ); ?>" type="tel" value="<?php echo esc_attr( $value ); ?>" />
<?php
}
}

// Register this class as a CampTix Addon.
camptix_register_addon( 'CampTix_Addon_Mobile_Field' );
1 change: 1 addition & 0 deletions camptix.php
Original file line number Diff line number Diff line change
Expand Up @@ -7738,6 +7738,7 @@ function load_default_addons() {
'field-twitter' => $this->get_default_addon_path( 'field-twitter.php' ),
'field-url' => $this->get_default_addon_path( 'field-url.php' ),
'field-country' => $this->get_default_addon_path( 'field-country.php' ),
'field-mobile' => $this->get_default_addon_path( 'field-mobile.php' ),
'field-tshirt' => $this->get_default_addon_path( 'field-tshirt.php' ),
'shortcodes' => $this->get_default_addon_path( 'shortcodes.php' ),
'payment-paypal' => $this->get_default_addon_path( 'payment-paypal.php' ),
Expand Down