Yoast\WP\SEO\Introductions\User_Interface
Introductions_Seen_Route::set_introduction_seen()
Sets whether the introduction is seen.
Метод класса: Introductions_Seen_Route{}
Хуков нет.
Возвращает
WP_REST_Response|WP_Error
. The success or failure response.
Использование
$Introductions_Seen_Route = new Introductions_Seen_Route(); $Introductions_Seen_Route->set_introduction_seen( $request );
- $request(WP_REST_Request) (обязательный)
- The request object.
Код Introductions_Seen_Route::set_introduction_seen() Introductions Seen Route::set introduction seen Yoast 24.4
public function set_introduction_seen( WP_REST_Request $request ) { $params = $request->get_params(); $introduction_id = $params['introduction_id']; $is_seen = $params['is_seen']; if ( $this->introductions_collector->is_available_introduction( $introduction_id ) ) { try { $user_id = $this->user_helper->get_current_user_id(); $result = $this->introductions_seen_repository->set_introduction( $user_id, $introduction_id, $is_seen ); } catch ( Exception $exception ) { return new WP_Error( 'wpseo_introductions_seen_error', $exception->getMessage(), (object) [] ); } return new WP_REST_Response( [ 'json' => (object) [ 'success' => $result, ], ], ( $result ) ? 200 : 400 ); } return new WP_REST_Response( [], 400 ); }