Use new code style
This commit is contained in:
@ -112,8 +112,7 @@ abstract class Base_Signup_Field {
|
||||
public function is_hidden() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_hidden;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines if this field/element is related to site creation or not.
|
||||
@ -124,8 +123,7 @@ abstract class Base_Signup_Field {
|
||||
public function is_site_field() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_site_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines if this field/element is related to user/customer creation or not.
|
||||
@ -136,8 +134,7 @@ abstract class Base_Signup_Field {
|
||||
public function is_user_field() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_user_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field as an array that the form builder can understand.
|
||||
@ -159,8 +156,7 @@ abstract class Base_Signup_Field {
|
||||
'all_attributes' => $this->get_all_attributes(),
|
||||
'fields' => array($this, 'get_editor_fields'),
|
||||
);
|
||||
|
||||
} // end get_field_as_type_option;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifies the HTML attr array before sending it over to the form.
|
||||
@ -174,8 +170,7 @@ abstract class Base_Signup_Field {
|
||||
public function get_editor_fields_html_attr($html_attr, $field_name) {
|
||||
|
||||
return $html_attr;
|
||||
|
||||
} // end get_editor_fields_html_attr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tabs available for this field.
|
||||
@ -189,8 +184,7 @@ abstract class Base_Signup_Field {
|
||||
'content',
|
||||
'style',
|
||||
);
|
||||
|
||||
} // end get_tabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the pre-filled value for the field.
|
||||
@ -207,20 +201,15 @@ abstract class Base_Signup_Field {
|
||||
$value_session = wu_get_isset($session->get('signup'), $this->attributes['id']);
|
||||
|
||||
if ($value_session) {
|
||||
|
||||
$value = $value_session;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if (wu_get_isset($this->attributes, 'from_request') && wu_get_isset($this->attributes, 'id')) {
|
||||
|
||||
$value = wu_request($this->attributes['id'], '');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
||||
} // end get_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the style attributes for the field.
|
||||
@ -235,24 +224,17 @@ abstract class Base_Signup_Field {
|
||||
$width = (int) wu_get_isset($this->attributes, 'width');
|
||||
|
||||
if ($width) {
|
||||
|
||||
if ($width !== 100) {
|
||||
|
||||
$styles[] = 'float: left';
|
||||
|
||||
$styles[] = sprintf('width: %s%%', $width);
|
||||
|
||||
} // end if;
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
$styles[] = 'clear: both';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return implode('; ', $styles);
|
||||
|
||||
} // end calculate_style_attr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the config values for the current field.
|
||||
@ -265,8 +247,7 @@ abstract class Base_Signup_Field {
|
||||
public function set_attributes($attributes) {
|
||||
|
||||
$this->attributes = $attributes;
|
||||
|
||||
} // end set_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -277,8 +258,7 @@ abstract class Base_Signup_Field {
|
||||
public function force_attributes() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default values for the editor fields.
|
||||
@ -289,8 +269,7 @@ abstract class Base_Signup_Field {
|
||||
public function defaults() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -308,8 +287,7 @@ abstract class Base_Signup_Field {
|
||||
'default',
|
||||
'required',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the editor fields.
|
||||
@ -327,32 +305,27 @@ abstract class Base_Signup_Field {
|
||||
* Checks if this is a site field
|
||||
*/
|
||||
if ($this->is_site_field()) {
|
||||
|
||||
$final_field_list['_site_notice_field_' . uniqid()] = array(
|
||||
$final_field_list[ '_site_notice_field_' . uniqid() ] = array(
|
||||
'type' => 'note',
|
||||
'classes' => 'wu--mt-px',
|
||||
'desc' => sprintf('<div class="wu-p-4 wu--m-4 wu-bg-blue-100 wu-text-blue-600 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid">%s</div>', __('This is a site-related field. For that reason, this field will not show up when no plans are present on the shopping cart.', 'wp-ultimo')),
|
||||
'order' => 98.5,
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks if this is a user field
|
||||
*/
|
||||
if ($this->is_user_field()) {
|
||||
|
||||
$final_field_list['_user_notice_field_' . uniqid()] = array(
|
||||
$final_field_list[ '_user_notice_field_' . uniqid() ] = array(
|
||||
'type' => 'note',
|
||||
'classes' => 'wu--mt-px',
|
||||
'desc' => sprintf('<div class="wu-p-4 wu--m-4 wu-bg-blue-100 wu-text-blue-600 wu-border-t wu-border-l-0 wu-border-r-0 wu-border-b-0 wu-border-gray-300 wu-border-solid">%s</div>', __('This is a customer-related field. For that reason, this field will not show up when the user is logged and already has a customer on file.', 'wp-ultimo')),
|
||||
'order' => 98.5,
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
foreach ($final_field_list as $key => &$field) {
|
||||
|
||||
$field['html_attr'] = wu_get_isset($field, 'html_attr', array());
|
||||
|
||||
$value = wu_get_isset($attributes, $key, null);
|
||||
@ -360,13 +333,10 @@ abstract class Base_Signup_Field {
|
||||
$field['default'] = wu_get_isset($this->defaults(), $key, '');
|
||||
|
||||
if ($value === null) {
|
||||
|
||||
$value = $field['default'];
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if (wu_get_isset($field['html_attr'], 'data-model')) {
|
||||
|
||||
$model_name = wu_get_isset($field['html_attr'], 'data-model', 'product');
|
||||
|
||||
$models = explode(',', (string) $value);
|
||||
@ -374,34 +344,29 @@ abstract class Base_Signup_Field {
|
||||
$func_name = "wu_get_{$model_name}";
|
||||
|
||||
if (function_exists($func_name)) {
|
||||
$selected = array_map(
|
||||
function ($id) use ($func_name) {
|
||||
|
||||
$selected = array_map(function($id) use ($func_name) {
|
||||
$model = call_user_func($func_name, absint($id));
|
||||
|
||||
$model = call_user_func($func_name, absint($id));
|
||||
if ( ! $model) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$model) {
|
||||
|
||||
return false;
|
||||
|
||||
} // end if;
|
||||
|
||||
return $model->to_search_results();
|
||||
|
||||
}, $models);
|
||||
return $model->to_search_results();
|
||||
},
|
||||
$models
|
||||
);
|
||||
|
||||
$selected = array_filter($selected);
|
||||
|
||||
$field['html_attr']['data-selected'] = json_encode($selected);
|
||||
}
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end if;
|
||||
|
||||
if (!is_null($value)) {
|
||||
|
||||
if ( ! is_null($value)) {
|
||||
$field['value'] = $value;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$field['html_attr'] = $this->get_editor_fields_html_attr($field['html_attr'], $field['type']);
|
||||
|
||||
@ -411,23 +376,22 @@ abstract class Base_Signup_Field {
|
||||
$show_reqs = false;
|
||||
|
||||
if (isset($field['wrapper_html_attr'])) {
|
||||
|
||||
$show_reqs = wu_get_isset($field['wrapper_html_attr'], 'v-show');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$tab = wu_get_isset($field, 'tab', 'content');
|
||||
|
||||
$field['wrapper_html_attr'] = array_merge(wu_get_isset($field, 'wrapper_html_attr', array()), array(
|
||||
'v-cloak' => 1,
|
||||
'v-show' => sprintf('require("type", "%s") && require("tab", "%s")', $this->get_type(), $tab) . ($show_reqs ? " && $show_reqs" : ''),
|
||||
));
|
||||
|
||||
} // end foreach;
|
||||
$field['wrapper_html_attr'] = array_merge(
|
||||
wu_get_isset($field, 'wrapper_html_attr', array()),
|
||||
array(
|
||||
'v-cloak' => 1,
|
||||
'v-show' => sprintf('require("type", "%s") && require("tab", "%s")', $this->get_type(), $tab) . ($show_reqs ? " && $show_reqs" : ''),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $final_field_list;
|
||||
|
||||
} // end get_editor_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all the attributes.
|
||||
@ -449,8 +413,7 @@ abstract class Base_Signup_Field {
|
||||
$field_keys = array_keys($this->get_fields());
|
||||
|
||||
return array_merge($this->default_fields(), $field_keys, $styles);
|
||||
|
||||
} // end get_all_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Treat the attributes array to avoid reaching the input var limits.
|
||||
@ -463,8 +426,7 @@ abstract class Base_Signup_Field {
|
||||
public function reduce_attributes($attributes) {
|
||||
|
||||
return $attributes;
|
||||
|
||||
} // end reduce_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of all the default fields available.
|
||||
@ -608,7 +570,5 @@ abstract class Base_Signup_Field {
|
||||
);
|
||||
|
||||
return $fields;
|
||||
|
||||
} // end fields_list;
|
||||
|
||||
} // end class Base_Signup_Field;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -32,8 +32,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'billing_address';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@ -44,8 +43,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this a user-related field?
|
||||
@ -59,8 +57,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
public function is_user_field() {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_user_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -73,8 +70,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Address', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -87,8 +83,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds billing address fields such as country, zip code.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -101,8 +96,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds billing address fields such as country, zip code.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@ -115,8 +109,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-map1';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -132,8 +125,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
return array(
|
||||
'zip_and_country' => true,
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -146,8 +138,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
return array(
|
||||
'name',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -161,8 +152,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
'id' => 'billing_address',
|
||||
'required' => true,
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -180,8 +170,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
'value' => true,
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a filed alternative.
|
||||
@ -199,9 +188,12 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
|
||||
$field = $base_field;
|
||||
|
||||
$option_template = sprintf('<option v-for="item in %s" :value="item.code">
|
||||
$option_template = sprintf(
|
||||
'<option v-for="item in %s" :value="item.code">
|
||||
{{ item.name }}
|
||||
</option>', $data_key_name);
|
||||
</option>',
|
||||
$data_key_name
|
||||
);
|
||||
|
||||
$field['type'] = 'select';
|
||||
$field['options_template'] = $option_template;
|
||||
@ -214,8 +206,7 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
$field['title'] = sprintf('<span v-html="%s">%s</span>', "labels.$label_key_field", $field['title']);
|
||||
|
||||
return $field;
|
||||
|
||||
} // end build_select_alternative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -235,29 +226,21 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
* Checks for an existing customer
|
||||
*/
|
||||
if ($customer) {
|
||||
|
||||
$fields = $customer->get_billing_address()->get_fields($zip_only);
|
||||
|
||||
} else {
|
||||
|
||||
$checkout_form = \WP_Ultimo\Checkout\Checkout::get_instance()->checkout_form;
|
||||
|
||||
$fields = \WP_Ultimo\Objects\Billing_Address::fields($zip_only, $checkout_form);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if (isset($fields['billing_country'])) {
|
||||
|
||||
$fields['billing_country']['html_attr'] = array(
|
||||
'v-model' => 'country',
|
||||
);
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
if (!$zip_only) {
|
||||
|
||||
if ( ! $zip_only) {
|
||||
if (isset($fields['billing_state'])) {
|
||||
|
||||
$fields['billing_state']['html_attr'] = array(
|
||||
'v-model.lazy' => 'state',
|
||||
);
|
||||
@ -268,11 +251,9 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
* @since 2.0.11
|
||||
*/
|
||||
$fields['billing_state_select'] = $this->build_select_alternative($fields['billing_state'], 'state_list', 'state_field');
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if (isset($fields['billing_city'])) {
|
||||
|
||||
$fields['billing_city']['html_attr'] = array(
|
||||
'v-model.lazy' => 'city',
|
||||
);
|
||||
@ -283,21 +264,15 @@ class Signup_Field_Billing_Address extends Base_Signup_Field {
|
||||
* @since 2.0.11
|
||||
*/
|
||||
$fields['billing_city_select'] = $this->build_select_alternative($fields['billing_city'], 'city_list', 'city_field');
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($fields as &$field) {
|
||||
|
||||
$field['wrapper_classes'] = trim(wu_get_isset($field, 'wrapper_classes', '') . ' ' . $attributes['element_classes']);
|
||||
|
||||
} // end foreach;
|
||||
}
|
||||
|
||||
uasort($fields, 'wu_sort_by_order');
|
||||
|
||||
return $fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Billing_Address;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -32,8 +32,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'checkbox';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@ -44,8 +43,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this a user-related field?
|
||||
@ -59,8 +57,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
public function is_user_field() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_user_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -73,8 +70,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Checkbox', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -87,8 +83,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a checkout box that can be checked by the customer.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -101,8 +96,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a checkout box that can be checked by the customer.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@ -115,8 +109,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-check-square';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -130,10 +123,9 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
''
|
||||
'',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -150,8 +142,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
'save_as',
|
||||
'required',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -162,8 +153,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
public function force_attributes() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -182,8 +172,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
'order' => 12,
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -197,7 +186,7 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
|
||||
$checkout_fields = array();
|
||||
|
||||
$checkout_fields[$attributes['id']] = array(
|
||||
$checkout_fields[ $attributes['id'] ] = array(
|
||||
'type' => 'checkbox',
|
||||
'id' => $attributes['id'],
|
||||
'name' => $attributes['name'],
|
||||
@ -207,21 +196,15 @@ class Signup_Field_Checkbox extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
if ($attributes['default_state']) {
|
||||
|
||||
$checkout_fields[$attributes['id']]['html_attr']['checked'] = 'checked';
|
||||
|
||||
} // end if;
|
||||
$checkout_fields[ $attributes['id'] ]['html_attr']['checked'] = 'checked';
|
||||
}
|
||||
|
||||
$value = $this->get_value();
|
||||
|
||||
if ($value !== '' && (bool) $value === true) {
|
||||
|
||||
$checkout_fields[$attributes['id']]['html_attr']['checked'] = 'checked';
|
||||
|
||||
} // end if;
|
||||
$checkout_fields[ $attributes['id'] ]['html_attr']['checked'] = 'checked';
|
||||
}
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Checkbox;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -32,8 +32,7 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'color_picker';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@ -44,8 +43,7 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -58,8 +56,7 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Color', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -72,8 +69,7 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a color picker field.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -86,8 +82,7 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a color picker field.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@ -100,8 +95,7 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-droplet';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -115,10 +109,9 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
''
|
||||
'',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -136,8 +129,7 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
'required',
|
||||
'save_as',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -148,8 +140,7 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
public function force_attributes() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -167,8 +158,7 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
'desc' => __('Set the default value for this color field.', 'wp-ultimo'),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -197,7 +187,5 @@ class Signup_Field_Color extends Base_Signup_Field {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Color;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -32,8 +32,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'discount_code';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@ -44,8 +43,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -58,8 +56,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Coupon Code', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -72,8 +69,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds an additional field to apply a discount code.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -86,8 +82,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds an additional field to apply a discount code.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@ -100,8 +95,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-tag1';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -118,8 +112,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
'placeholder' => '',
|
||||
'default' => '',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -134,8 +127,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
'placeholder',
|
||||
'tooltip',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -148,8 +140,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
return array(
|
||||
'id' => 'discount_code',
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -160,8 +151,7 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
public function get_fields() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -201,12 +191,10 @@ class Signup_Field_Discount_Code extends Base_Signup_Field {
|
||||
'html_attr' => array(
|
||||
'v-model.lazy' => 'discount_code',
|
||||
'v-init:discount_code' => "'{$this->get_value()}'",
|
||||
'v-init:toggle_discount_code' => !empty($this->get_value()),
|
||||
'v-init:toggle_discount_code' => ! empty($this->get_value()),
|
||||
),
|
||||
);
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Discount_Code;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -24,15 +24,14 @@ defined('ABSPATH') || exit;
|
||||
class Signup_Field_Email extends Base_Signup_Field {
|
||||
|
||||
/**
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function get_type(): string {
|
||||
|
||||
return 'email';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
*
|
||||
@ -41,8 +40,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
public function is_required(): bool {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
/**
|
||||
* Is this a user-related field?
|
||||
*
|
||||
@ -54,8 +52,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
public function is_user_field(): bool {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_user_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -68,8 +65,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Email', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -82,8 +78,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a email address field. This email address will be used to create the WordPress user.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -96,8 +91,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a email address field. This email address will be used to create the WordPress user.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
*
|
||||
@ -108,8 +102,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
public function get_icon(): string {
|
||||
|
||||
return 'dashicons-wu-at-sign';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -125,8 +118,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
return array(
|
||||
'display_notices' => true,
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -141,8 +133,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
'placeholder',
|
||||
'tooltip',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -156,8 +147,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
'id' => 'email_address',
|
||||
'required' => true,
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -179,8 +169,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -195,9 +184,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
$checkout_fields = array();
|
||||
|
||||
if (is_user_logged_in()) {
|
||||
|
||||
if ($attributes['display_notices']) {
|
||||
|
||||
$checkout_fields['login_note'] = array(
|
||||
'type' => 'note',
|
||||
'title' => __('Not you?', 'wp-ultimo'),
|
||||
@ -207,13 +194,9 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
'style' => $this->calculate_style_attr(),
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
if ($attributes['display_notices']) {
|
||||
|
||||
$checkout_fields['login_note'] = array(
|
||||
'type' => 'note',
|
||||
'title' => __('Existing customer?', 'wp-ultimo'),
|
||||
@ -223,8 +206,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
'style' => $this->calculate_style_attr(),
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$checkout_fields['email_address'] = array(
|
||||
'type' => 'text',
|
||||
@ -240,12 +222,10 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
'style' => $this->calculate_style_attr(),
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the login message for users that are not logged in.
|
||||
@ -273,8 +253,7 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
<?php // phpcs:enable
|
||||
|
||||
return ob_get_clean();
|
||||
|
||||
} // end render_existing_customer_message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the login message for users that are not logged in.
|
||||
@ -302,7 +281,5 @@ class Signup_Field_Email extends Base_Signup_Field {
|
||||
<?php
|
||||
|
||||
return ob_get_clean();
|
||||
|
||||
} // end render_not_you_customer_message;
|
||||
|
||||
} // end class Signup_Field_Email;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -32,8 +32,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'hidden';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@ -44,8 +43,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -58,8 +56,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Hidden Field', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -72,8 +69,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a hidden field. This is useful when coupled with the "Fill from the Request" option, to load values from the URL, for example.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -86,8 +82,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a hidden field. This is useful when coupled with the "Fill from the Request" option, to load values from the URL, for example.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@ -100,8 +95,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-eye-off';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -117,8 +111,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
return array(
|
||||
'from_request' => true,
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -132,8 +125,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
'id',
|
||||
'save_as',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -144,8 +136,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
public function force_attributes() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -166,8 +157,7 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
'value' => '',
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the pre-filled value for the field.
|
||||
@ -180,14 +170,11 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
$value = parent::get_value();
|
||||
|
||||
if (empty($value)) {
|
||||
|
||||
$value = $this->attributes['fixed_value'];
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
||||
} // end get_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -207,7 +194,5 @@ class Signup_Field_Hidden extends Base_Signup_Field {
|
||||
'value' => $this->get_value(),
|
||||
),
|
||||
);
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Hidden;
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use \WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -33,8 +33,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'order_bump';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@ -45,8 +44,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -59,8 +57,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Order Bump', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -73,8 +70,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a product offer that the customer can click to add to the current cart.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -87,8 +83,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a product offer that the customer can click to add to the current cart.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@ -101,8 +96,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-gift';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -119,8 +113,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
'order_bump_template' => 'simple',
|
||||
'display_product_description' => 0,
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -134,8 +127,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
// 'id',
|
||||
'name',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -148,8 +140,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
return array(
|
||||
'order_bump_template' => 'simple',
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of available pricing table templates.
|
||||
@ -162,8 +153,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
$available_templates = Field_Templates_Manager::get_instance()->get_templates_as_options('order_bump');
|
||||
|
||||
return $available_templates;
|
||||
|
||||
} // end get_templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -233,8 +223,7 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
// );
|
||||
|
||||
return $editor_fields;
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -250,11 +239,9 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
|
||||
$product = is_numeric($product_id) ? wu_get_product($product_id) : wu_get_product_by_slug($product_id);
|
||||
|
||||
if (!$product) {
|
||||
|
||||
if ( ! $product) {
|
||||
return array();
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$attributes['product'] = $product;
|
||||
|
||||
@ -269,7 +256,5 @@ class Signup_Field_Order_Bump extends Base_Signup_Field {
|
||||
'wrapper_classes' => $attributes['element_classes'],
|
||||
),
|
||||
);
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Order_Bump;
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use \WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -25,15 +25,14 @@ defined('ABSPATH') || exit;
|
||||
class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
|
||||
/**
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function get_type(): string {
|
||||
|
||||
return 'order_summary';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
*
|
||||
@ -42,8 +41,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
public function is_required(): bool {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -56,8 +54,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Order Summary', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -70,8 +67,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a summary table with prices, key subscription dates, discounts, and taxes.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -84,8 +80,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a summary table with prices, key subscription dates, discounts, and taxes.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
*
|
||||
@ -96,8 +91,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
public function get_icon(): string {
|
||||
|
||||
return 'dashicons-wu-dollar-sign';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -114,8 +108,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
'order_summary_template' => 'clean',
|
||||
'table_columns' => 'simple',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -128,8 +121,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
return array(
|
||||
'name',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -142,8 +134,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
return array(
|
||||
'id' => 'order_summary',
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of available pricing table templates.
|
||||
@ -156,8 +147,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
$available_templates = Field_Templates_Manager::get_instance()->get_templates_as_options('order_summary');
|
||||
|
||||
return $available_templates;
|
||||
|
||||
} // end get_templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -176,7 +166,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
'options' => array(
|
||||
'simple' => __('Simplified', 'wp-ultimo'),
|
||||
'full' => __('Display All', 'wp-ultimo'),
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
$editor_fields['order_summary_template'] = array(
|
||||
@ -206,8 +196,7 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
// );
|
||||
|
||||
return $editor_fields;
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -225,16 +214,14 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
* Backwards compatibility with previous betas
|
||||
*/
|
||||
if ($attributes['order_summary_template'] === 'simple') {
|
||||
|
||||
$attributes['order_summary_template'] = 'clean';
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$template_class = Field_Templates_Manager::get_instance()->get_template_class('order_summary', $attributes['order_summary_template']);
|
||||
|
||||
$content = $template_class ? $template_class->render_container($attributes) : __('Template does not exist.', 'wp-ultimo');
|
||||
|
||||
$checkout_fields[$attributes['id']] = array(
|
||||
$checkout_fields[ $attributes['id'] ] = array(
|
||||
'type' => 'note',
|
||||
'desc' => $content,
|
||||
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
|
||||
@ -245,7 +232,5 @@ class Signup_Field_Order_Summary extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Order_Summary;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -32,8 +32,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'password';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@ -44,8 +43,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this a user-related field?
|
||||
@ -59,8 +57,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
public function is_user_field() {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_user_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -73,8 +70,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Password', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -87,8 +83,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a password field, with options for enforcing password strength and adding password confirmation field. This password is then used to create the WordPress user.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -101,8 +96,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a password field, with options for enforcing password strength and adding password confirmation field. This password is then used to create the WordPress user.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@ -115,8 +109,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-lock1';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -133,8 +126,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
'password_confirm_field' => false,
|
||||
'password_confirm_label' => __('Confirm Password', 'wp-ultimo'),
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -149,8 +141,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
'placeholder',
|
||||
'tooltip',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -164,8 +155,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
'id' => 'password',
|
||||
'required' => true,
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -189,8 +179,7 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
'value' => 1,
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -205,10 +194,8 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
* Logged in user, bail.
|
||||
*/
|
||||
if (is_user_logged_in()) {
|
||||
|
||||
return array();
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$checkout_fields = array();
|
||||
|
||||
@ -231,7 +218,6 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
if ($attributes['password_confirm_field']) {
|
||||
|
||||
$checkout_fields['password_conf'] = array(
|
||||
'type' => 'password',
|
||||
'id' => 'password_conf',
|
||||
@ -249,11 +235,8 @@ class Signup_Field_Password extends Base_Signup_Field {
|
||||
'style' => $this->calculate_style_attr(),
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Password;
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use \WP_Ultimo\Managers\Gateway_Manager;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Managers\Gateway_Manager;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -33,8 +33,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'payment';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@ -45,8 +44,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -59,8 +57,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Payment', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -73,8 +70,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds the payment options and the additional fields required to complete a purchase (e.g. credit card field).', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -87,8 +83,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds the payment options and the additional fields required to complete a purchase (e.g. credit card field).', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@ -101,8 +96,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-credit-card2';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -116,10 +110,9 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
''
|
||||
'',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -132,8 +125,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
return array(
|
||||
'name',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -146,8 +138,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
return array(
|
||||
'id' => 'payment',
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -158,8 +149,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
public function get_fields() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -194,8 +184,7 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
* Checks if we need to add the
|
||||
* auto renew field.
|
||||
*/
|
||||
if (!wu_get_setting('force_auto_renew', 1)) {
|
||||
|
||||
if ( ! wu_get_setting('force_auto_renew', 1)) {
|
||||
$auto_renewable_gateways = Gateway_Manager::get_instance()->get_auto_renewable_gateways();
|
||||
|
||||
$fields['auto_renew'] = array(
|
||||
@ -212,13 +201,10 @@ class Signup_Field_Payment extends Base_Signup_Field {
|
||||
'wrapper_html_attr' => array(
|
||||
'v-cloak' => 1,
|
||||
'v-show' => sprintf('%s.includes(gateway) && order.should_collect_payment && order.has_recurring', json_encode($auto_renewable_gateways)),
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Payment;
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use \WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -25,15 +25,14 @@ defined('ABSPATH') || exit;
|
||||
class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
|
||||
/**
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function get_type(): string {
|
||||
|
||||
return 'period_selection';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
*
|
||||
@ -42,8 +41,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
public function is_required(): bool {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -56,8 +54,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Period Select', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -70,8 +67,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a period selector, that allows customers to switch between different billing periods.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -84,8 +80,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a period selector, that allows customers to switch between different billing periods.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
*
|
||||
@ -96,8 +91,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
public function get_icon(): string {
|
||||
|
||||
return 'dashicons-wu dashicons-wu-toggle-right';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -113,8 +107,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
return array(
|
||||
'period_selection_template' => 'clean',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -127,8 +120,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
return array(
|
||||
// 'name',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -143,8 +135,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
'name' => __('Plan Duration Switch', 'wp-ultimo'),
|
||||
'required' => true,
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of available pricing table templates.
|
||||
@ -157,8 +148,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
$available_templates = Field_Templates_Manager::get_instance()->get_templates_as_options('period_selection');
|
||||
|
||||
return $available_templates;
|
||||
|
||||
} // end get_template_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -283,8 +273,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
return $editor_fields;
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -297,14 +286,12 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
public function to_fields_array($attributes) {
|
||||
|
||||
if (wu_get_isset($attributes, 'period_selection_template') === 'legacy') {
|
||||
|
||||
wp_register_script('wu-legacy-signup', wu_get_asset('legacy-signup.js', 'js'), array('wu-functions'), wu_get_version());
|
||||
|
||||
wp_enqueue_script('wu-legacy-signup');
|
||||
|
||||
wp_enqueue_style('legacy-shortcodes', wu_get_asset('legacy-shortcodes.css', 'css'), array('dashicons'), wu_get_version());
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$template_class = Field_Templates_Manager::get_instance()->get_template_class('period_selection', $attributes['period_selection_template']);
|
||||
|
||||
@ -312,7 +299,7 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
|
||||
$checkout_fields = array();
|
||||
|
||||
$checkout_fields[$attributes['id']] = array(
|
||||
$checkout_fields[ $attributes['id'] ] = array(
|
||||
'type' => 'note',
|
||||
'id' => $attributes['id'],
|
||||
'wrapper_classes' => $attributes['element_classes'],
|
||||
@ -334,7 +321,5 @@ class Signup_Field_Period_Selection extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Period_Selection;
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use \WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -25,15 +25,14 @@ defined('ABSPATH') || exit;
|
||||
class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
|
||||
/**
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function get_type(): string {
|
||||
|
||||
return 'pricing_table';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
*
|
||||
@ -42,8 +41,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
public function is_required(): bool {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -56,8 +54,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Pricing Table', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -70,8 +67,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a pricing table section that customers can use to choose a plan to subscribe to.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -84,8 +80,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a pricing table section that customers can use to choose a plan to subscribe to.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
*
|
||||
@ -96,8 +91,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
public function get_icon(): string {
|
||||
|
||||
return 'dashicons-wu dashicons-wu-columns';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -116,8 +110,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
'force_different_durations' => false,
|
||||
'hide_pricing_table_when_pre_selected' => false,
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -130,8 +123,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
return array(
|
||||
// 'name',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -146,8 +138,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
'name' => __('Plan Selection', 'wp-ultimo'),
|
||||
'required' => true,
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of available pricing table templates.
|
||||
@ -160,8 +151,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
$available_templates = Field_Templates_Manager::get_instance()->get_templates_as_options('pricing_table');
|
||||
|
||||
return $available_templates;
|
||||
|
||||
} // end get_pricing_table_templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -242,8 +232,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
// );
|
||||
|
||||
return $editor_fields;
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -256,12 +245,10 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
public function to_fields_array($attributes) {
|
||||
|
||||
if (wu_get_isset($attributes, 'pricing_table_template') === 'legacy') {
|
||||
|
||||
wp_enqueue_style('legacy-shortcodes', wu_get_asset('legacy-shortcodes.css', 'css'), array('dashicons'), wu_get_version());
|
||||
|
||||
wp_add_inline_style('legacy-shortcodes', \WP_Ultimo\Checkout\Legacy_Checkout::get_instance()->get_legacy_dynamic_styles());
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$product_list = explode(',', (string) $attributes['pricing_table_products']);
|
||||
|
||||
@ -276,10 +263,8 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
* Hide when pre-selected.
|
||||
*/
|
||||
if (wu_should_hide_form_field($attributes)) {
|
||||
|
||||
return array();
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$template_attributes = array(
|
||||
'products' => $products,
|
||||
@ -294,7 +279,7 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
|
||||
$checkout_fields = array();
|
||||
|
||||
$checkout_fields[$attributes['id']] = array(
|
||||
$checkout_fields[ $attributes['id'] ] = array(
|
||||
'type' => 'note',
|
||||
'id' => $attributes['id'],
|
||||
'wrapper_classes' => wu_get_isset($attributes, 'wrapper_element_classes', ''),
|
||||
@ -306,7 +291,5 @@ class Signup_Field_Pricing_Table extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Pricing_Table;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -24,15 +24,14 @@ defined('ABSPATH') || exit;
|
||||
class Signup_Field_Products extends Base_Signup_Field {
|
||||
|
||||
/**
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function get_type(): string {
|
||||
|
||||
return 'products';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
*
|
||||
@ -41,8 +40,7 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
public function is_required(): bool {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -55,8 +53,7 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Product', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -69,8 +66,7 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Hidden field used to pre-select products. This is useful when you have a signup page for specific offering/bundles and do not want your customers to be able to choose plans and products manually.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -83,8 +79,7 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Hidden field used to pre-select products. This is useful when you have a signup page for specific offering/bundles and do not want your customers to be able to choose plans and products manually.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
*
|
||||
@ -95,8 +90,7 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
public function get_icon(): string {
|
||||
|
||||
return 'dashicons-wu dashicons-wu-package';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -110,10 +104,9 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
''
|
||||
'',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -124,8 +117,7 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
public function default_fields() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -139,8 +131,7 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
'name' => __('Pre-selected Products', 'wp-ultimo'),
|
||||
'id' => 'products',
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -166,8 +157,7 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -184,22 +174,19 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
$products = explode(',', (string) $attributes['products']);
|
||||
|
||||
foreach ($products as $product_id) {
|
||||
|
||||
$checkout_fields["products[{$product_id}]"] = array(
|
||||
$checkout_fields[ "products[{$product_id}]" ] = array(
|
||||
'type' => 'hidden',
|
||||
'value' => $product_id,
|
||||
'html_attr' => array(
|
||||
'v-bind:name' => "'products[]'",
|
||||
),
|
||||
);
|
||||
|
||||
} // end foreach;
|
||||
}
|
||||
|
||||
$this->insert_products_in_form($products);
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts the products in the form.
|
||||
@ -212,10 +199,8 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
static $added = false;
|
||||
|
||||
if ($added) {
|
||||
|
||||
return;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$added = true;
|
||||
|
||||
@ -224,24 +209,23 @@ class Signup_Field_Products extends Base_Signup_Field {
|
||||
data.products.push(...%s);
|
||||
data.products = data.products.map((value) => parseInt(value) || value);
|
||||
data.products = [...new Set(data.products)];
|
||||
} // end if;
|
||||
}
|
||||
return data;
|
||||
});";
|
||||
|
||||
if (did_action('wu-checkout')) {
|
||||
|
||||
wp_add_inline_script('wu-checkout', sprintf($script, json_encode($products)), 'before');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
} // end if;
|
||||
add_action(
|
||||
'wp_enqueue_scripts',
|
||||
function () use ($script, $products) {
|
||||
|
||||
add_action('wp_enqueue_scripts', function() use ($script, $products) {
|
||||
|
||||
wp_add_inline_script('wu-checkout', sprintf($script, json_encode($products)), 'before');
|
||||
|
||||
}, 11);
|
||||
|
||||
} // end insert_products_in_form;
|
||||
|
||||
} // end class Signup_Field_Products;
|
||||
wp_add_inline_script('wu-checkout', sprintf($script, json_encode($products)), 'before');
|
||||
},
|
||||
11
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -32,8 +32,7 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'select';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@ -44,8 +43,7 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -58,8 +56,7 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Select', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -72,8 +69,7 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a select field.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -86,8 +82,7 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a select field.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@ -100,8 +95,7 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-list1';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -115,10 +109,9 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
''
|
||||
'',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -137,8 +130,7 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
'required',
|
||||
'save_as',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -149,8 +141,7 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
public function force_attributes() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -237,8 +228,7 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
return $editor_fields;
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -253,10 +243,8 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
$options = array();
|
||||
|
||||
foreach ($attributes['options'] as $_option) {
|
||||
|
||||
$options[$_option['key']] = $_option['label'];
|
||||
|
||||
} // end foreach;
|
||||
$options[ $_option['key'] ] = $_option['label'];
|
||||
}
|
||||
|
||||
return array(
|
||||
$attributes['id'] => array(
|
||||
@ -272,7 +260,5 @@ class Signup_Field_Select extends Base_Signup_Field {
|
||||
'value' => $this->get_value(),
|
||||
),
|
||||
);
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Select;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -24,15 +24,14 @@ defined('ABSPATH') || exit;
|
||||
class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
|
||||
/**
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function get_type(): string {
|
||||
|
||||
return 'shortcode';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
*
|
||||
@ -41,8 +40,7 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
public function is_required(): bool {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -55,8 +53,7 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Shortcode', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -69,8 +66,7 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Displays the content of a given WordPress shortcode. Can be useful to inset content from other plugins inside a WP Multisite WaaS checkout form.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -83,8 +79,7 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Displays the content of a given WordPress shortcode. Can be useful to insert content from other plugins inside a WP Multisite WaaS checkout form.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
*
|
||||
@ -95,8 +90,7 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
public function get_icon(): string {
|
||||
|
||||
return 'dashicons-wu-terminal';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -110,10 +104,9 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
''
|
||||
'',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -127,8 +120,7 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
// 'id',
|
||||
// 'name',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -141,8 +133,7 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
return array(
|
||||
'name' => __('Shortcode', 'wp-ultimo'),
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -160,8 +151,7 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
'desc' => __('Please, enter the full shortcode, including [].', 'wp-ultimo'),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -184,7 +174,5 @@ class Signup_Field_Shortcode extends Base_Signup_Field {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Shortcode;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -32,8 +32,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'site_title';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@ -44,8 +43,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines if this field/element is related to site creation or not.
|
||||
@ -56,8 +54,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
public function is_site_field() {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_site_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -70,8 +67,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Site Title', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -84,8 +80,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a Site Title field. This value is used to set the site title for the site being created.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -98,8 +93,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a Site Title field. This value is used to set the site title for the site being created.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@ -112,8 +106,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-type';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -129,8 +122,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
return array(
|
||||
'auto_generate_site_title' => false,
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -145,8 +137,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
'placeholder',
|
||||
'tooltip',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -160,8 +151,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
'id' => 'site_title',
|
||||
'required' => true,
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -183,8 +173,7 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -199,7 +188,6 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
* If we should auto-generate, add as hidden.
|
||||
*/
|
||||
if (isset($attributes['auto_generate_site_title']) && $attributes['auto_generate_site_title']) {
|
||||
|
||||
return array(
|
||||
'auto_generate_site_title' => array(
|
||||
'type' => 'hidden',
|
||||
@ -211,11 +199,10 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
'id' => 'site_title',
|
||||
'html_attr' => array(
|
||||
'v-bind:value' => 'username',
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return array(
|
||||
'site_title' => array(
|
||||
@ -233,7 +220,5 @@ class Signup_Field_Site_Title extends Base_Signup_Field {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Site_Title;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -24,15 +24,14 @@ defined('ABSPATH') || exit;
|
||||
class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
|
||||
/**
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function get_type(): string {
|
||||
|
||||
return 'site_url';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
*
|
||||
@ -41,8 +40,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
public function is_required(): bool {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
/**
|
||||
* Defines if this field/element is related to site creation or not.
|
||||
*
|
||||
@ -51,8 +49,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
public function is_site_field(): bool {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_site_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -65,8 +62,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Site URL', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -79,8 +75,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a Site URL field. This is used to set the URL of the site being created.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -93,8 +88,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a Site URL field. This is used to set the URL of the site being created.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
*
|
||||
@ -105,8 +99,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
public function get_icon(): string {
|
||||
|
||||
return 'dashicons-wu-globe1';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -128,8 +121,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
'display_field_attachments' => true,
|
||||
'available_domains' => $current_site->domain . PHP_EOL,
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -144,8 +136,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
'placeholder',
|
||||
'tooltip',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -159,8 +150,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
'id' => 'site_url',
|
||||
'required' => true,
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -246,8 +236,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of available pricing table templates.
|
||||
@ -263,8 +252,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
return apply_filters('wu_get_pricing_table_templates', $templates);
|
||||
|
||||
} // end get_url_preview_templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -279,7 +267,6 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
* If we should auto-generate, add as hidden.
|
||||
*/
|
||||
if ($attributes['auto_generate_site_url']) {
|
||||
|
||||
return array(
|
||||
'auto_generate_site_url' => array(
|
||||
'type' => 'hidden',
|
||||
@ -292,8 +279,7 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
'value' => uniqid(),
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$checkout_fields = array();
|
||||
|
||||
@ -316,7 +302,6 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
if ($attributes['display_field_attachments']) {
|
||||
|
||||
$checkout_fields['site_url']['classes'] .= ' xs:wu-rounded-none';
|
||||
|
||||
$checkout_fields['site_url']['prefix'] = ' ';
|
||||
@ -337,11 +322,9 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
'v-cloak' => 1,
|
||||
'v-show' => 'is_subdomain',
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if ($attributes['available_domains'] && $attributes['enable_domain_selection']) {
|
||||
|
||||
$options = $this->get_domain_options($attributes['available_domains']);
|
||||
|
||||
$checkout_fields['site_domain'] = array(
|
||||
@ -361,11 +344,9 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
'style' => $this->calculate_style_attr(),
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if ($attributes['display_url_preview']) {
|
||||
|
||||
$content = wu_get_template_contents('legacy/signup/steps/step-domain-url-preview');
|
||||
|
||||
$checkout_fields['site_url_preview'] = array(
|
||||
@ -377,12 +358,10 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
'style' => $this->calculate_style_attr(),
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
}
|
||||
/**
|
||||
* Get the domain options.
|
||||
*
|
||||
@ -397,7 +376,5 @@ class Signup_Field_Site_Url extends Base_Signup_Field {
|
||||
$domains = array_map(fn($item) => trim((string) $item), $domains);
|
||||
|
||||
return array_combine($domains, $domains);
|
||||
|
||||
} // end get_domain_options;
|
||||
|
||||
} // end class Signup_Field_Site_Url;
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use \WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -25,15 +25,14 @@ defined('ABSPATH') || exit;
|
||||
class Signup_Field_Steps extends Base_Signup_Field {
|
||||
|
||||
/**
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function get_type(): string {
|
||||
|
||||
return 'steps';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
*
|
||||
@ -42,8 +41,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
public function is_required(): bool {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -56,8 +54,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Steps', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -70,8 +67,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a list of the steps.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -84,8 +80,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a list of the steps.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
*
|
||||
@ -96,8 +91,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
public function get_icon(): string {
|
||||
|
||||
return 'dashicons-wu-filter_1';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -113,8 +107,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
return array(
|
||||
'steps_template' => 'clean',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -125,8 +118,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
public function default_fields() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -139,8 +131,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
return array(
|
||||
'id' => 'steps',
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of available pricing table templates.
|
||||
@ -153,8 +144,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
$available_templates = Field_Templates_Manager::get_instance()->get_templates_as_options('steps');
|
||||
|
||||
return $available_templates;
|
||||
|
||||
} // end get_templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -192,8 +182,7 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
// );
|
||||
|
||||
return $editor_fields;
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -206,12 +195,10 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
public function to_fields_array($attributes) {
|
||||
|
||||
if (wu_get_isset($attributes, 'steps_template') === 'legacy') {
|
||||
|
||||
wp_enqueue_style('legacy-shortcodes', wu_get_asset('legacy-shortcodes.css', 'css'), array('dashicons'), wu_get_version());
|
||||
|
||||
wp_add_inline_style('legacy-shortcodes', \WP_Ultimo\Checkout\Legacy_Checkout::get_instance()->get_legacy_dynamic_styles());
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$attributes['steps'] = \WP_Ultimo\Checkout\Checkout::get_instance()->steps;
|
||||
$attributes['current_step'] = \WP_Ultimo\Checkout\Checkout::get_instance()->step_name;
|
||||
@ -227,7 +214,5 @@ class Signup_Field_Steps extends Base_Signup_Field {
|
||||
'wrapper_classes' => $attributes['element_classes'],
|
||||
),
|
||||
);
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Steps;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -32,8 +32,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'submit_button';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@ -44,8 +43,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -58,8 +56,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Submit Button', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -72,8 +69,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a submit button. This is required to finalize single-step checkout forms or to navigate to the next step on multi-step checkout forms.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -86,8 +82,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a submit button. This is required to finalize single-step checkout forms or to navigate to the next step on multi-step checkout forms.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@ -100,8 +95,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-zap';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -118,8 +112,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
'enable_go_back_button' => false,
|
||||
'back_button_label' => __('← Go Back', 'wp-ultimo'),
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -133,8 +126,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
'id',
|
||||
'name',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -145,8 +137,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
public function force_attributes() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -179,8 +170,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -196,7 +186,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
|
||||
$fields = array();
|
||||
|
||||
$fields[$attributes['id'] . '_errors'] = array(
|
||||
$fields[ $attributes['id'] . '_errors' ] = array(
|
||||
'type' => 'html',
|
||||
'wrapper_classes' => 'wu_submit_button_errors wu-clear-both',
|
||||
'content' => '<span v-cloak class="wu-block wu-bg-red-100 wu-p-2 wu-mb-4" v-html="get_errors().join(' . esc_js(json_encode('<br>')) . ')"></span>',
|
||||
@ -205,7 +195,7 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
),
|
||||
);
|
||||
|
||||
$fields[$attributes['id'] . '_group'] = array(
|
||||
$fields[ $attributes['id'] . '_group' ] = array(
|
||||
'type' => 'group',
|
||||
'raw' => true,
|
||||
'default' => array(),
|
||||
@ -216,14 +206,12 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
$button_wrapper_classes = 'wu_submit_button';
|
||||
|
||||
if ($attributes['enable_go_back_button']) {
|
||||
|
||||
$steps = \WP_Ultimo\Checkout\Checkout::get_instance()->steps;
|
||||
|
||||
$is_first_step = isset($steps[0]) && $steps[0]['id'] === $attributes['step'];
|
||||
|
||||
if (!$is_first_step) {
|
||||
|
||||
$fields[$attributes['id'] . '_group']['fields'][$attributes['id'] . '_go_back'] = array(
|
||||
if ( ! $is_first_step) {
|
||||
$fields[ $attributes['id'] . '_group' ]['fields'][ $attributes['id'] . '_go_back' ] = array(
|
||||
'type' => 'html',
|
||||
'wrapper_classes' => 'md:wu-w-1/2 wu-box-border wu-float-left wu--mt-4',
|
||||
'id' => $attributes['id'] . '_go_back',
|
||||
@ -231,12 +219,10 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
$button_wrapper_classes .= ' md:wu-w-1/2 wu-box-border wu-float-left wu-text-right';
|
||||
}
|
||||
}
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end if;
|
||||
|
||||
$fields[$attributes['id'] . '_group']['fields'][$attributes['id']] = array(
|
||||
$fields[ $attributes['id'] . '_group' ]['fields'][ $attributes['id'] ] = array(
|
||||
'type' => 'submit',
|
||||
'wrapper_classes' => trim($button_wrapper_classes . ' ' . wu_get_isset($attributes, 'wrapper_element_classes', '')),
|
||||
'classes' => trim('button button-primary btn-primary' . ' ' . wu_get_isset($attributes, 'element_classes', '')),
|
||||
@ -245,15 +231,11 @@ class Signup_Field_Submit_Button extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
if ($attributes['enable_go_back_button']) {
|
||||
|
||||
$fields[$attributes['id'] . '_clear'] = array(
|
||||
$fields[ $attributes['id'] . '_clear' ] = array(
|
||||
'type' => 'clear',
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Submit_Button;
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,9 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use \WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
use \WP_Ultimo\Models\Site;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Managers\Field_Templates_Manager;
|
||||
use WP_Ultimo\Models\Site;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -26,15 +26,14 @@ defined('ABSPATH') || exit;
|
||||
class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
|
||||
/**
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
* Returns the type of the field.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function get_type(): string {
|
||||
|
||||
return 'template_selection';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
*
|
||||
@ -43,8 +42,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
public function is_required(): bool {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -57,8 +55,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Templates', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -71,8 +68,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a template selection section. This allows the customer to choose a pre-built site to be used as a template for the site being currently created.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -85,8 +81,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a template selection section. This allows the customer to choose a pre-built site to be used as a template for the site being currently created.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
*
|
||||
@ -97,8 +92,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
public function get_icon(): string {
|
||||
|
||||
return 'dashicons-wu-layout';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -118,8 +112,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
'cols' => 3,
|
||||
'hide_template_selection_when_pre_selected' => false,
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -132,8 +125,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
return array(
|
||||
// 'name',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -148,8 +140,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
'name' => __('Template Selection', 'wp-ultimo'),
|
||||
'required' => true,
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of available pricing table templates.
|
||||
@ -162,8 +153,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
$available_templates = Field_Templates_Manager::get_instance()->get_templates_as_options('template_selection');
|
||||
|
||||
return $available_templates;
|
||||
|
||||
} // end get_template_selection_templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -223,9 +213,14 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
'data-label-field' => 'title',
|
||||
'data-search-field' => 'title',
|
||||
'data-max-items' => 999,
|
||||
'data-include' => implode(',', wu_get_site_templates(array(
|
||||
'fields' => 'blog_id',
|
||||
))),
|
||||
'data-include' => implode(
|
||||
',',
|
||||
wu_get_site_templates(
|
||||
array(
|
||||
'fields' => 'blog_id',
|
||||
)
|
||||
)
|
||||
),
|
||||
),
|
||||
'wrapper_html_attr' => array(
|
||||
'v-show' => 'template_selection_type === \'name\'',
|
||||
@ -272,8 +267,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
// );
|
||||
|
||||
return $editor_fields;
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Treat the attributes array to avoid reaching the input var limits.
|
||||
@ -290,8 +284,7 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
$attributes['sites'] = array_values(array_column($array_sites, 'blog_id'));
|
||||
|
||||
return $attributes;
|
||||
|
||||
} // end reduce_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -316,41 +309,33 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
* Hide when pre-selected.
|
||||
*/
|
||||
if (wu_should_hide_form_field($attributes)) {
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if (wu_get_isset($attributes, 'template_selection_template') === 'legacy') {
|
||||
|
||||
wp_register_script('wu-legacy-signup', wu_get_asset('legacy-signup.js', 'js'), array('wu-functions'), wu_get_version());
|
||||
|
||||
wp_enqueue_script('wu-legacy-signup');
|
||||
|
||||
wp_enqueue_style('legacy-shortcodes', wu_get_asset('legacy-shortcodes.css', 'css'), array('dashicons'), wu_get_version());
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$site_list = $this->site_list($attributes);
|
||||
|
||||
$customer_sites = array();
|
||||
|
||||
if (wu_get_setting('allow_own_site_as_template')) {
|
||||
|
||||
$customer = wu_get_current_customer();
|
||||
|
||||
if ($customer) {
|
||||
|
||||
$customer_sites = $customer->get_sites(array('fields' => 'ids'));
|
||||
|
||||
$site_list = array_merge(
|
||||
$customer_sites,
|
||||
$site_list
|
||||
);
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end if;
|
||||
}
|
||||
}
|
||||
|
||||
$sites = array_map('wu_get_site', $site_list);
|
||||
|
||||
@ -371,15 +356,14 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
|
||||
$content = $template_class ? $template_class->render_container($template_attributes, $this) : __('Template does not exist.', 'wp-ultimo');
|
||||
|
||||
$checkout_fields[$attributes['id']] = array(
|
||||
$checkout_fields[ $attributes['id'] ] = array(
|
||||
'type' => 'note',
|
||||
'desc' => $content,
|
||||
'wrapper_classes' => $attributes['element_classes'],
|
||||
);
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return site list according to selection type used.
|
||||
@ -392,19 +376,14 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
$selection_type = wu_get_isset($attributes, 'template_selection_type', 'name');
|
||||
|
||||
if ($selection_type === 'name') {
|
||||
|
||||
return explode(',', $attributes['template_selection_sites']);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if ($selection_type === 'all') {
|
||||
|
||||
return wu_get_site_templates(array('fields' => 'blog_id'));
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if ($selection_type === 'categories') {
|
||||
|
||||
return array_column(
|
||||
\WP_Ultimo\Models\Site::get_all_by_categories(
|
||||
$attributes['template_selection_categories'],
|
||||
@ -414,12 +393,8 @@ class Signup_Field_Template_Selection extends Base_Signup_Field {
|
||||
),
|
||||
'blog_id'
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return explode(',', $attributes['template_selection_sites']);
|
||||
|
||||
} // end site_list;
|
||||
|
||||
|
||||
} // end class Signup_Field_Template_Selection;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -32,8 +32,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'terms_of_use';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@ -44,8 +43,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this a user-related field?
|
||||
@ -59,8 +57,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
public function is_user_field() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_user_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -73,8 +70,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Terms of Use', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -87,8 +83,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a terms and conditions checkbox that must be marked before the account/site can be created.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -101,8 +96,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a terms and conditions checkbox that must be marked before the account/site can be created.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@ -115,8 +109,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-file-text';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -132,8 +125,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
return array(
|
||||
'tou_name' => __('I agree with the terms of use.', 'wp-ultimo'),
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -144,8 +136,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
public function default_fields() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -159,8 +150,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
'id' => 'terms_of_use',
|
||||
'name' => __('Terms of Use', 'wp-ultimo'),
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -185,8 +175,7 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
'placeholder' => __('e.g. https://yoursite.com/terms', 'wp-ultimo'),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -212,7 +201,5 @@ class Signup_Field_Terms_Of_Use extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
return $checkout_fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Terms_Of_Use;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -32,8 +32,7 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'text';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@ -44,8 +43,7 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return false;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -58,8 +56,7 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Text', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -72,8 +69,7 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds a text field that the customer can fill with arbitrary data.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -86,8 +82,7 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds a text field that the customer can fill with arbitrary data.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@ -100,8 +95,7 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-edit-3';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -115,10 +109,9 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
public function defaults() {
|
||||
|
||||
return array(
|
||||
''
|
||||
'',
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -137,8 +130,7 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
'required',
|
||||
'save_as',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -149,8 +141,7 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
public function force_attributes() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -161,8 +152,7 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
public function get_fields() {
|
||||
|
||||
return array();
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -188,7 +178,5 @@ class Signup_Field_Text extends Base_Signup_Field {
|
||||
);
|
||||
|
||||
return $fields;
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Text;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace WP_Ultimo\Checkout\Signup_Fields;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Base_Signup_Field;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
@ -32,8 +32,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
public function get_type() {
|
||||
|
||||
return 'username';
|
||||
|
||||
} // end get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this field should be present on the checkout flow or not.
|
||||
@ -44,8 +43,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
public function is_required() {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this a user-related field?
|
||||
@ -59,8 +57,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
public function is_user_field() {
|
||||
|
||||
return true;
|
||||
|
||||
} // end is_user_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requires the title of the field/element type.
|
||||
@ -73,8 +70,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
public function get_title() {
|
||||
|
||||
return __('Username', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the description of the field/element.
|
||||
@ -87,8 +83,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
public function get_description() {
|
||||
|
||||
return __('Adds an username field. This username will be used to create the WordPress user.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tooltip of the field/element.
|
||||
@ -101,8 +96,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
public function get_tooltip() {
|
||||
|
||||
return __('Adds an username field. This username will be used to create the WordPress user.', 'wp-ultimo');
|
||||
|
||||
} // end get_tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the icon to be used on the selector.
|
||||
@ -115,8 +109,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
public function get_icon() {
|
||||
|
||||
return 'dashicons-wu-user1';
|
||||
|
||||
} // end get_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default values for the field-elements.
|
||||
@ -132,8 +125,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
return array(
|
||||
'auto_generate_username' => false,
|
||||
);
|
||||
|
||||
} // end defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of keys of the default fields we want to display on the builder.
|
||||
@ -148,8 +140,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
'placeholder',
|
||||
'tooltip',
|
||||
);
|
||||
|
||||
} // end default_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you want to force a particular attribute to a value, declare it here.
|
||||
@ -163,8 +154,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
'id' => 'username',
|
||||
'required' => true,
|
||||
);
|
||||
|
||||
} // end force_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional fields specific to this type.
|
||||
@ -186,8 +176,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end get_fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field/element actual field array to be used on the checkout form.
|
||||
@ -202,13 +191,10 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
* Logged in user, bail.
|
||||
*/
|
||||
if (is_user_logged_in()) {
|
||||
|
||||
return array();
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
if (isset($attributes['auto_generate_username']) && $attributes['auto_generate_username']) {
|
||||
|
||||
return array(
|
||||
'auto_generate_username' => array(
|
||||
'type' => 'hidden',
|
||||
@ -221,8 +207,7 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
'value' => uniqid(),
|
||||
),
|
||||
);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return array(
|
||||
'username' => array(
|
||||
@ -245,7 +230,5 @@ class Signup_Field_Username extends Base_Signup_Field {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
} // end to_fields_array;
|
||||
|
||||
} // end class Signup_Field_Username;
|
||||
}
|
||||
}
|
||||
|
@ -29,10 +29,10 @@ class Base_Field_Template {
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $attributes = array();
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $attributes = array();
|
||||
|
||||
/**
|
||||
* Field Template Constructor
|
||||
@ -41,10 +41,9 @@ class Base_Field_Template {
|
||||
*
|
||||
* @param array $attributes The attributes passed to the field.
|
||||
*/
|
||||
public function __construct($attributes = array())
|
||||
{
|
||||
$this->attributes = $attributes;
|
||||
} // end __construct;
|
||||
public function __construct($attributes = array()) {
|
||||
$this->attributes = $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* The render type for the template.
|
||||
@ -66,8 +65,7 @@ class Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'ajax';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@ -80,8 +78,7 @@ class Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Field Template', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@ -94,8 +91,7 @@ class Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('Description', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
/**
|
||||
* The preview image of the field template.
|
||||
*
|
||||
@ -106,8 +102,7 @@ class Base_Field_Template {
|
||||
public function get_preview(): string {
|
||||
|
||||
return '';
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@ -117,7 +112,7 @@ class Base_Field_Template {
|
||||
* @param array $attributes The field template attributes.
|
||||
* @return void
|
||||
*/
|
||||
public function output($attributes) {} // end output;
|
||||
public function output($attributes) {}
|
||||
|
||||
/**
|
||||
* Renders the content.
|
||||
@ -136,8 +131,7 @@ class Base_Field_Template {
|
||||
$this->output($attributes);
|
||||
|
||||
return ob_get_clean();
|
||||
|
||||
} // end render;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the content on the checkout form as a wrapper.
|
||||
@ -153,23 +147,15 @@ class Base_Field_Template {
|
||||
public function render_container($attributes, $signup_field = false) {
|
||||
|
||||
if ($this->get_render_type() === 'ajax') {
|
||||
|
||||
if ($signup_field) {
|
||||
|
||||
$attributes = $signup_field->reduce_attributes($attributes);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
$markup = sprintf('<dynamic :template="get_template(\'%s\', %s)"></dynamic>', esc_js($this->id), esc_attr(json_encode($attributes)));
|
||||
|
||||
} else {
|
||||
|
||||
$markup = $this->render($attributes);
|
||||
|
||||
} // end if;
|
||||
}
|
||||
|
||||
return $markup;
|
||||
|
||||
} // end render_container;
|
||||
|
||||
} // end class Base_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Order_Bump;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Template Selection Simple
|
||||
@ -52,8 +52,7 @@ class Simple_Order_Bump_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'ajax';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@ -66,8 +65,7 @@ class Simple_Order_Bump_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Simple', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@ -80,8 +78,7 @@ class Simple_Order_Bump_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('A simple layout with minimal styling, just enough to make it usable out-of-the-box.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview of the field template.
|
||||
@ -92,8 +89,7 @@ class Simple_Order_Bump_Field_Template extends Base_Field_Template {
|
||||
public function get_preview(): string {
|
||||
|
||||
return wu_get_asset('checkout-forms/clean-template-selection.png');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@ -106,10 +102,8 @@ class Simple_Order_Bump_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
/**
|
||||
* Loads the actual order-bump template
|
||||
*/
|
||||
* Loads the actual order-bump template
|
||||
*/
|
||||
wu_get_template('checkout/templates/order-bump/simple', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Simple_Order_Bump_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Order_Summary;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Order Summary Clean
|
||||
@ -52,8 +52,7 @@ class Clean_Order_Summary_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'dynamic';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@ -66,8 +65,7 @@ class Clean_Order_Summary_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Clean', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@ -80,8 +78,7 @@ class Clean_Order_Summary_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('A simple layout with minimal styling, just enough to make it usable out-of-the-box.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview of the field template.
|
||||
@ -92,8 +89,7 @@ class Clean_Order_Summary_Field_Template extends Base_Field_Template {
|
||||
public function get_preview(): string {
|
||||
|
||||
return wu_get_asset('checkout-forms/clean-order-summary.png');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@ -106,10 +102,8 @@ class Clean_Order_Summary_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
/**
|
||||
* Loads the actual order-summary template
|
||||
*/
|
||||
* Loads the actual order-summary template
|
||||
*/
|
||||
wu_get_template('checkout/templates/order-summary/simple', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Clean_Order_Summary_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Period_Selection;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Template Selection Clean
|
||||
@ -52,8 +52,7 @@ class Clean_Period_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'dynamic';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@ -66,8 +65,7 @@ class Clean_Period_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Clean', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@ -80,8 +78,7 @@ class Clean_Period_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('A simple template with clean markup and no styling, ready to be customized with custom CSS.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview image of the field template.
|
||||
@ -94,8 +91,7 @@ class Clean_Period_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_preview(): string {
|
||||
|
||||
return wu_get_asset('checkout-forms/clean-period-selection.png');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@ -108,7 +104,5 @@ class Clean_Period_Selection_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
wu_get_template('checkout/templates/period-selection/clean', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Clean_Period_Selection_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Period_Selection;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Template Selection Clean
|
||||
@ -52,8 +52,7 @@ class Legacy_Period_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'dynamic';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@ -66,8 +65,7 @@ class Legacy_Period_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Legacy', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@ -80,8 +78,7 @@ class Legacy_Period_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('Implementation of the layout that shipped with WP Multisite WaaS < 1.10.X.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview image of the field template.
|
||||
@ -94,8 +91,7 @@ class Legacy_Period_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_preview(): string {
|
||||
|
||||
return wu_get_asset('checkout-forms/legacy-period-selection.png');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@ -108,7 +104,5 @@ class Legacy_Period_Selection_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
wu_get_template('checkout/templates/period-selection/legacy', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Legacy_Period_Selection_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Pricing_Table;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Template Selection Clean
|
||||
@ -52,8 +52,7 @@ class Legacy_Pricing_Table_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'dynamic';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@ -66,8 +65,7 @@ class Legacy_Pricing_Table_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Legacy', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@ -80,8 +78,7 @@ class Legacy_Pricing_Table_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('Implementation of the layout that shipped with WP Ultimo < 1.10.X.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview image of the field template.
|
||||
@ -94,8 +91,7 @@ class Legacy_Pricing_Table_Field_Template extends Base_Field_Template {
|
||||
public function get_preview(): string {
|
||||
|
||||
return wu_get_asset('checkout-forms/legacy-pricing-table.png');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@ -108,7 +104,5 @@ class Legacy_Pricing_Table_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
wu_get_template('checkout/templates/pricing-table/legacy', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Legacy_Pricing_Table_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Pricing_Table;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Base Field Template
|
||||
@ -43,8 +43,7 @@ class List_Pricing_Table_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Simple List', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@ -57,8 +56,7 @@ class List_Pricing_Table_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('Simple stylized list with price, recurrence, and the plan description.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview image of the field template.
|
||||
@ -71,8 +69,7 @@ class List_Pricing_Table_Field_Template extends Base_Field_Template {
|
||||
public function get_preview(): string {
|
||||
|
||||
return wu_get_asset('checkout-forms/list-pricing-table.png');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@ -85,7 +82,5 @@ class List_Pricing_Table_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
wu_get_template('checkout/templates/pricing-table/list', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class List_Pricing_Table_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Steps;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Template Selection Clean
|
||||
@ -52,8 +52,7 @@ class Clean_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'dynamic';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@ -66,8 +65,7 @@ class Clean_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Clean', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@ -80,8 +78,7 @@ class Clean_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('A simple layout with minimal styling, just enough to make it usable out-of-the-box.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview of the field template.
|
||||
@ -92,8 +89,7 @@ class Clean_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_preview(): string {
|
||||
|
||||
return wu_get_asset('checkout-forms/clean-steps.png');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@ -106,7 +102,5 @@ class Clean_Steps_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
wu_get_template('checkout/templates/steps/clean', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Clean_Steps_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Steps;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Template Selection Clean
|
||||
@ -52,8 +52,7 @@ class Legacy_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'dynamic';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@ -66,8 +65,7 @@ class Legacy_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Legacy', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@ -80,8 +78,7 @@ class Legacy_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('Implementation of the layout that shipped with WP Ultimo < 1.10.X.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview of the field template.
|
||||
@ -92,8 +89,7 @@ class Legacy_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_preview(): string {
|
||||
|
||||
return wu_get_asset('checkout-forms/legacy-steps.png');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@ -106,7 +102,5 @@ class Legacy_Steps_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
wu_get_template('checkout/templates/steps/legacy', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Legacy_Steps_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Steps;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Template Selection Clean
|
||||
@ -52,8 +52,7 @@ class Minimal_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'dynamic';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@ -66,8 +65,7 @@ class Minimal_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Minimal', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@ -80,8 +78,7 @@ class Minimal_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('A simple template with clean markup and no styling, ready to be customized with custom CSS.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview of the field template.
|
||||
@ -92,8 +89,7 @@ class Minimal_Steps_Field_Template extends Base_Field_Template {
|
||||
public function get_preview(): string {
|
||||
|
||||
return wu_get_asset('checkout-forms/minimal-steps.png');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@ -106,7 +102,5 @@ class Minimal_Steps_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
wu_get_template('checkout/templates/steps/minimal', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Minimal_Steps_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Template_Selection;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Template Selection Clean
|
||||
@ -52,8 +52,7 @@ class Clean_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'ajax';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@ -66,8 +65,7 @@ class Clean_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Clean', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@ -80,8 +78,7 @@ class Clean_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_description(): string {
|
||||
|
||||
return __('A simple layout with minimal styling, just enough to make it usable out-of-the-box.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview of the field template.
|
||||
@ -92,8 +89,7 @@ class Clean_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_preview(): string {
|
||||
|
||||
return wu_get_asset('checkout-forms/clean-template-selection.png');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@ -106,7 +102,5 @@ class Clean_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
wu_get_template('checkout/templates/template-selection/clean', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Clean_Template_Selection_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Template_Selection;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Legacy Field Template Selector
|
||||
@ -41,8 +41,7 @@ class Legacy_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'ajax';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@ -55,8 +54,7 @@ class Legacy_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Legacy', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@ -69,8 +67,7 @@ class Legacy_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('Implementation of the layout that shipped with WP Ultimo < 1.10.X.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview image of the field template.
|
||||
@ -83,8 +80,7 @@ class Legacy_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_preview(): string {
|
||||
|
||||
return wu_get_asset('checkout-forms/legacy-template-selection.png');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@ -97,7 +93,5 @@ class Legacy_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
wu_get_template('checkout/templates/template-selection/legacy', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Legacy_Template_Selection_Field_Template;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Template_Selection;
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
use \WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
use WP_Ultimo\Checkout\Signup_Fields\Field_Templates\Base_Field_Template;
|
||||
|
||||
/**
|
||||
* Template Selection Minimal
|
||||
@ -41,8 +41,7 @@ class Minimal_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_render_type(): string {
|
||||
|
||||
return 'ajax';
|
||||
|
||||
} // end get_render_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The title of the field template.
|
||||
@ -55,8 +54,7 @@ class Minimal_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_title() {
|
||||
|
||||
return __('Minimal', 'wp-ultimo');
|
||||
|
||||
} // end get_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the field template.
|
||||
@ -69,8 +67,7 @@ class Minimal_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_description() {
|
||||
|
||||
return __('A simple template with clean markup and no styling, ready to be customized with custom CSS.', 'wp-ultimo');
|
||||
|
||||
} // end get_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* The preview of the field template.
|
||||
@ -81,8 +78,7 @@ class Minimal_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function get_preview(): string {
|
||||
|
||||
return wu_get_asset('checkout-forms/minimal-template-selection.png');
|
||||
|
||||
} // end get_preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of the template.
|
||||
@ -95,7 +91,5 @@ class Minimal_Template_Selection_Field_Template extends Base_Field_Template {
|
||||
public function output($attributes) {
|
||||
|
||||
wu_get_template('checkout/templates/template-selection/minimal', $attributes);
|
||||
|
||||
} // end output;
|
||||
|
||||
} // end class Minimal_Template_Selection_Field_Template;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user