tp_lock = $tp_lock; $this->notices = $notices; } public function add_hooks() { add_action( 'admin_init', array( $this, 'handle_notice' ) ); } public function handle_notice() { $locker_reason = $this->tp_lock->get_locker_reason(); if ( (bool) $locker_reason ) { $text = '
' . __( 'Some communications with the translation proxy are locked.', 'wpml-translation-management' ) . '
'; $text .= '' . $locker_reason . '
'; $notice = $this->notices->create_notice( self::NOTICE_LOCKED, $text, self::NOTICE_GROUP ); $notice->set_css_class_types( 'notice-warning' ); $this->notices->add_notice( $notice ); } else { $this->notices->remove_notice( self::NOTICE_GROUP, self::NOTICE_LOCKED ); } } }