slug = $slug; $this->args = wp_parse_args( $args, array( 'title' => '', 'content' => '', 'target_id' => '', 'position' => 'top', 'active_callback' => null, ) ); } /** * Gets the pointer slug. * * @since 1.83.0 * * @return string Unique pointer slug. */ public function get_slug() { return $this->slug; } /** * Gets the pointer title. * * @since 1.83.0 * * @return string Pointer title. */ public function get_title() { return $this->args['title']; } /** * Gets the pointer content. * * @since 1.83.0 * * @return string Pointer content. */ public function get_content() { if ( is_callable( $this->args['content'] ) ) { return call_user_func( $this->args['content'] ); } else { return '

' . wp_kses( $this->args['content'], 'googlesitekit_admin_pointer' ) . '

'; } } /** * Gets the pointer target ID. * * @since 1.83.0 * * @return string Pointer target ID. */ public function get_target_id() { return $this->args['target_id']; } /** * Gets the pointer position. * * @since 1.83.0 * * @return string|array Pointer position. */ public function get_position() { return $this->args['position']; } /** * Checks whether the pointer is active. * * This method executes the active callback in order to determine whether the pointer should be active or not. * * @since 1.83.0 * * @param string $hook_suffix The current admin screen hook suffix. * @return bool True if the pointer is active, false otherwise. */ public function is_active( $hook_suffix ) { if ( empty( $this->args['title'] ) || empty( $this->args['content'] ) || empty( $this->args['target_id'] ) ) { return false; } if ( ! is_callable( $this->args['active_callback'] ) ) { return true; } return (bool) call_user_func( $this->args['active_callback'], $hook_suffix ); } }