get_template_path(), ) ); $this->authentication = $authentication; $this->endpoints = $endpoints; $this->strings = $strings; $this->authentication_data = get_option( WPML_TM_ATE_Authentication::AMS_DATA_KEY, array() ); $wpml_support = esc_html__( 'WPML support', 'wpml-translation-management' ); $wpml_support_link = '' . $wpml_support . ''; $this->model = [ 'status_button_text' => $this->get_status_button_text(), 'synchronize_button_text' => $this->strings->get_synchronize_button_text(), 'is_ate_communication_locked' => Lock::isLocked(), 'strings' => [ 'error_help' => sprintf( esc_html__( 'Please try again in a few minutes. If the problem persists, please contact %s.', 'wpml-translation-management' ), $wpml_support_link ), ], ]; } /** * @return string */ public function get_template_path() { return WPML_TM_PATH . '/templates/ATE'; } public function init_hooks() { add_action( 'wpml_tm_mcs_' . ICL_TM_TMETHOD_ATE, array( $this, 'render' ) ); } /** * @param array $args * * @return array */ public function get_model( array $args = array() ) { if ( array_key_exists( 'wizard', $args ) ) { $this->model['strings']['error_help'] = esc_html__( 'You can continue the Translation Management configuration later by going to WPML -> Settings -> How to translate posts and pages.', 'wpml-translation-management' ); } return $this->model; } public function render() { echo $this->get_template() ->show( $this->get_model(), 'mcs-ate-controls.twig' ); } public function get_strings() { return $this->strings; } private function has_translators() { /** @var TranslationManagement $iclTranslationManagement */ global $iclTranslationManagement; return $iclTranslationManagement->has_translators(); } /** * @return mixed */ private function get_status_button_text() { return $this->strings->get_current_status_attribute( 'button' ); } /** * @return array */ public function get_script_data() { return array( 'hasTranslators' => $this->has_translators(), 'currentStatus' => $this->strings->get_status(), 'statuses' => $this->strings->get_statuses(), ); } }