Automattic\WooCommerce\Internal\Admin\Logging
PageController::render_search_field
Render a form for searching within log files.
Метод класса: PageController{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->render_search_field(): void;
Код PageController::render_search_field() PageController::render search field WC 10.5.0
<?php
private function render_search_field(): void {
$params = $this->get_query_params( array( 'date_end', 'date_filter', 'date_start', 'search', 'source' ) );
$defaults = $this->get_query_param_defaults();
$file_count = $this->file_controller->get_files( $params, true );
if ( $file_count > 0 ) {
?>
<form id="logs-search" class="wc-logs-search" method="get">
<fieldset class="wc-logs-search-fieldset">
<input type="hidden" name="page" value="wc-status" />
<input type="hidden" name="tab" value="logs" />
<input type="hidden" name="view" value="search_results" />
<?php foreach ( $params as $key => $value ) : ?>
<?php if ( $value !== $defaults[ $key ] ) : ?>
<input
type="hidden"
name="<?php echo esc_attr( $key ); ?>"
value="<?php echo esc_attr( $value ); ?>"
/>
<?php endif; ?>
<?php endforeach; ?>
<label for="logs-search-field">
<?php esc_html_e( 'Search within these files', 'woocommerce' ); ?>
<input
id="logs-search-field"
class="wc-logs-search-field"
type="text"
name="search"
value="<?php echo esc_attr( $params['search'] ); ?>"
/>
</label>
<?php submit_button( __( 'Search', 'woocommerce' ), 'secondary', null, false ); ?>
</fieldset>
<?php if ( $file_count >= $this->file_controller::SEARCH_MAX_FILES ) : ?>
<div class="wc-logs-search-notice">
<?php
printf(
// translators: %s is a number.
esc_html__(
'⚠️ Only %s files can be searched at one time. Try filtering the file list before searching.',
'woocommerce'
),
esc_html( number_format_i18n( $this->file_controller::SEARCH_MAX_FILES ) )
);
?>
</div>
<?php endif; ?>
</form>
<?php
}
}