BeforeHooks.php
4 weeks ago
class-wcml-setup-handlers.php
4 weeks ago
class-wcml-setup-ui.php
4 weeks ago
class-wcml-setup.php
4 weeks ago
class-wcml-setup-handlers.php
44 lines
| 1 | <?php |
| 2 | |
| 3 | use WPML\FP\Obj; |
| 4 | |
| 5 | class WCML_Setup_Handlers { |
| 6 | |
| 7 | private $woocommerce_wpml; |
| 8 | |
| 9 | public function __construct( woocommerce_wpml $woocommerce_wpml ) { |
| 10 | $this->woocommerce_wpml = $woocommerce_wpml; |
| 11 | } |
| 12 | |
| 13 | public function save_attributes( array $data ) { |
| 14 | |
| 15 | if ( isset( $data['attributes'] ) ) { |
| 16 | $this->woocommerce_wpml->attributes->set_translatable_attributes( $data['attributes'] ); |
| 17 | } |
| 18 | |
| 19 | } |
| 20 | |
| 21 | public function save_multi_currency( array $data ) { |
| 22 | |
| 23 | $this->woocommerce_wpml->get_multi_currency(); |
| 24 | |
| 25 | if ( Obj::prop( WCML_Setup::MULTI_CURRENCY_STATUS_GET_KEY, $data ) ) { |
| 26 | $this->woocommerce_wpml->multi_currency->enable(); |
| 27 | } else { |
| 28 | $this->woocommerce_wpml->multi_currency->disable(); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | public function install_store_pages( array $data ) { |
| 33 | |
| 34 | if ( ! empty( $data['install_missing_pages'] ) ) { |
| 35 | WC_Install::create_pages(); |
| 36 | } |
| 37 | |
| 38 | if ( ! empty( $data['install_missing_pages'] ) || ! empty( $data['create_pages'] ) ) { |
| 39 | $this->woocommerce_wpml->store->create_missing_store_pages_with_redirect(); |
| 40 | } |
| 41 | |
| 42 | } |
| 43 | } |
| 44 |