Automattic\WooCommerce\Internal\Admin\Logging\FileV2
SearchListTable::column_line()
Render the line column.
Метод класса: SearchListTable{}
Хуков нет.
Возвращает
Строку
.
Использование
$SearchListTable = new SearchListTable(); $SearchListTable->column_line( $item ): string;
- $item(массив) (обязательный)
- The current search result being rendered.
Код SearchListTable::column_line() SearchListTable::column line WC 9.8.2
public function column_line( array $item ): string { $params = $this->page_controller->get_query_params( array( 'search' ) ); $line = $item['line']; // Highlight matches within the line. $pattern = preg_quote( $params['search'], '/' ); preg_match_all( "/$pattern/i", $line, $matches, PREG_OFFSET_CAPTURE ); if ( is_array( $matches[0] ) && count( $matches[0] ) >= 1 ) { $length_change = 0; foreach ( $matches[0] as $match ) { $replace = '<span class="search-match">' . $match[0] . '</span>'; $offset = $match[1] + $length_change; $orig_length = strlen( $match[0] ); $replace_length = strlen( $replace ); $line = substr_replace( $line, $replace, $offset, $orig_length ); $length_change += $replace_length - $orig_length; } } return wp_kses_post( $line ); }