Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: JS error on Status Report page #3187

Merged
merged 5 commits into from
Dec 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions includes/classes/StatusReport/ElasticPressIo.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ public function get_title() : string {
* @return array
*/
public function get_groups() : array {
return [
$groups = [
$this->get_autosuggest_group(),
$this->get_instant_results_group(),
];

return array_values( array_filter( $groups ) );
}

/**
Expand All @@ -48,10 +50,14 @@ public function get_groups() : array {
* @return array
*/
protected function get_autosuggest_group() : array {
$title = __( 'Allowed Autosuggest Parameters', 'elasticpress' );

$autosuggest_feature = \ElasticPress\Features::factory()->get_registered_feature( 'autosuggest' );
$allowed_params = $autosuggest_feature->epio_autosuggest_set_and_get();

if ( ! $autosuggest_feature->is_active() ) {
return [];
}

$title = __( 'Allowed Autosuggest Parameters', 'elasticpress' );
$allowed_params = $autosuggest_feature->epio_autosuggest_set_and_get();

if ( empty( $allowed_params ) ) {
$fields['not_available'] = [
Expand All @@ -60,10 +66,8 @@ protected function get_autosuggest_group() : array {
];

return [
[
'title' => $title,
'fields' => $fields,
],
'title' => $title,
'fields' => $fields,
];
}

Expand Down Expand Up @@ -105,6 +109,12 @@ protected function get_autosuggest_group() : array {
* @return array
*/
protected function get_instant_results_group() : array {
$instant_results_feature = \ElasticPress\Features::factory()->get_registered_feature( 'instant-results' );

if ( ! $instant_results_feature->is_active() ) {
return [];
}

$title = __( 'Instant Results Template', 'elasticpress' );
$fields = [];

Expand Down