Use new code style
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user