| 1 |
<?php |
| 2 |
/** |
| 3 |
* Woo My Account Address widget. |
| 4 |
* |
| 5 |
* @package King_Addons |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace King_Addons; |
| 9 |
|
| 10 |
use Elementor\Group_Control_Typography; |
| 11 |
|
| 12 |
if (!defined('ABSPATH')) { |
| 13 |
exit; |
| 14 |
} |
| 15 |
|
| 16 |
/** |
| 17 |
* Renders address management form. |
| 18 |
*/ |
| 19 |
class Woo_My_Account_Address extends Abstract_My_Account_Widget |
| 20 |
{ |
| 21 |
public function get_name(): string |
| 22 |
{ |
| 23 |
return 'woo_my_account_address'; |
| 24 |
} |
| 25 |
|
| 26 |
public function get_title(): string |
| 27 |
{ |
| 28 |
return esc_html__('My Account Address', 'king-addons'); |
| 29 |
} |
| 30 |
|
| 31 |
public function get_icon(): string |
| 32 |
{ |
| 33 |
return 'king-addons-icon king-addons-woo-my-account-address'; |
| 34 |
} |
| 35 |
|
| 36 |
public function get_categories(): array |
| 37 |
{ |
| 38 |
return ['king-addons-woo-builder']; |
| 39 |
} |
| 40 |
|
| 41 |
public function get_style_depends(): array |
| 42 |
{ |
| 43 |
return [KING_ADDONS_ASSETS_UNIQUE_KEY . '-woo-my-account-address-style']; |
| 44 |
} |
| 45 |
|
| 46 |
protected function register_controls(): void |
| 47 |
{ |
| 48 |
$this->start_controls_section( |
| 49 |
'section_style', |
| 50 |
[ |
| 51 |
'label' => esc_html__('Style', 'king-addons'), |
| 52 |
'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 53 |
] |
| 54 |
); |
| 55 |
|
| 56 |
$this->add_group_control( |
| 57 |
Group_Control_Typography::get_type(), |
| 58 |
[ |
| 59 |
'name' => 'text_typography', |
| 60 |
'selector' => '{{WRAPPER}} .ka-woo-my-account-address', |
| 61 |
] |
| 62 |
); |
| 63 |
|
| 64 |
$this->end_controls_section(); |
| 65 |
} |
| 66 |
|
| 67 |
protected function render(): void |
| 68 |
{ |
| 69 |
if (!$this->should_render()) { |
| 70 |
$this->render_missing_account_notice(); |
| 71 |
return; |
| 72 |
} |
| 73 |
|
| 74 |
if (!$this->is_current_endpoint('edit-address')) { |
| 75 |
return; |
| 76 |
} |
| 77 |
|
| 78 |
if ($this->maybe_render_login_form()) { |
| 79 |
return; |
| 80 |
} |
| 81 |
|
| 82 |
echo '<div class="ka-woo-my-account-address">'; |
| 83 |
wc_get_template('myaccount/my-address.php', ['customer_id' => get_current_user_id()]); |
| 84 |
echo '</div>'; |
| 85 |
} |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|