id = Square\Plugin::PLUGIN_ID; $this->label = __( 'Square', 'woocommerce-square' ); $this->settings_handler = $settings_handler; parent::__construct(); } /** * Outputs the settings page. * * @internal * * @since 2.0.0 */ public function output() { global $current_section; if ( 'update' === $current_section ) { $this->output_update_section(); } else { $this->output_general_section(); } } /** * Outputs the general settings section. * * @since 2.0.0 */ private function output_general_section() { $this->settings_handler->admin_options(); self::output_import_products_modal_template(); } /** * Outputs the "Update" settings section. * * @since 2.0.0 */ private function output_update_section() { global $hide_save_button; // removes the save/update button from the screen $hide_save_button = true; Sync_Page::output(); } /** * Saves the settings. * * @internal * * @since 2.0.0 */ public function save() { $this->settings_handler->process_admin_options(); } /** * Gets the settings. * * @since 2.0.0 * * @return array */ public function get_settings() { return (array) apply_filters( 'woocommerce_get_settings_square', $this->settings_handler->get_form_fields() ); } /** * Gets the settings sections. * * @internal * * @since 2.0.0 * * @return array */ public function get_sections() { $sections = array( '' => __( 'Settings', 'woocommerce-square' ), // this key is intentionally blank 'update' => __( 'Update', 'woocommerce-square' ), ); /** * Filters the WooCommerce Square settings sections. * * @since 2.0.0 * * @param array $sections settings sections */ return (array) apply_filters( 'woocommerce_get_sections_square', $sections ); } /** * Outputs a backbone modal template for importing products from Square. * * @since 2.0.0 */ private static function output_import_products_modal_template() { ?>