| @@ -7,17 +7,24 @@ | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | namespace ElasticPress\Feature\Terms; |
| 10 | 10 | |
| 11 | -use ElasticPress\Feature as Feature; | |
| 12 | -use ElasticPress\Indexables as Indexables; | |
| 13 | -use ElasticPress\Indexable as Indexable; | |
| 14 | -use ElasticPress\FeatureRequirementsStatus as FeatureRequirementsStatus; | |
| 11 | +use ElasticPress\Feature; | |
| 12 | +use ElasticPress\FeatureRequirementsStatus; | |
| 13 | +use ElasticPress\Indexable; | |
| 14 | +use ElasticPress\Indexables; | |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * Terms feature class |
| 18 | 18 | */ |
| 19 | 19 | class Terms extends Feature { |
| 20 | + /** | |
| 21 | + * Whether the feature should be always visible in the dashboard | |
| 22 | + * | |
| 23 | + * @since 5.0.0 | |
| 24 | + * @var boolean | |
| 25 | + */ | |
| 26 | + protected $is_visible = false; | |
| 20 | 27 | |
| 21 | 28 | /** |
| 22 | 29 | * Initialize feature, setting it's config |
| 23 | 30 | * |
| @@ -25,17 +32,27 @@ | ||
| 25 | 32 | */ |
| 26 | 33 | public function __construct() { |
| 27 | 34 | $this->slug = 'terms'; |
| 28 | 35 | |
| 29 | - $this->title = esc_html__( 'Terms', 'elasticpress' ); | |
| 36 | + $this->requires_install_reindex = true; | |
| 30 | 37 | |
| 31 | - $this->summary = __( 'Improve WP_Term_Query relevancy and query performance. This feature is only needed if you are using WP_Term_Query directly.', 'elasticpress' ); | |
| 38 | + Indexables::factory()->register( new Indexable\Term\Term(), false ); | |
| 32 | 39 | |
| 33 | - $this->docs_url = __( 'https://elasticpress.zendesk.com/hc/en-us/articles/360050447492-Configuring-ElasticPress-via-the-Plugin-Dashboard#terms', 'elasticpress' ); | |
| 40 | + parent::__construct(); | |
| 41 | + } | |
| 34 | 42 | |
| 35 | - $this->requires_install_reindex = true; | |
| 43 | + /** | |
| 44 | + * Sets i18n strings. | |
| 45 | + * | |
| 46 | + * @return void | |
| 47 | + * @since 5.2.0 | |
| 48 | + */ | |
| 49 | + public function set_i18n_strings(): void { | |
| 50 | + $this->title = esc_html__( 'Terms', 'elasticpress' ); | |
| 36 | 51 | |
| 37 | - parent::__construct(); | |
| 52 | + $this->summary = '<p>' . __( 'This feature will empower your website to overcome traditional WordPress term search and query limitations that can present themselves at scale. This feature is only needed if you are using <code>WP_Term_Query</code> directly.', 'elasticpress' ) . '</p>'; | |
| 53 | + | |
| 54 | + $this->docs_url = __( 'https://www.elasticpress.io/resources/articles/configuring-elasticpress-via-the-plugin-dashboard/#terms', 'elasticpress' ); | |
| 38 | 55 | } |
| 39 | 56 | |
| 40 | 57 | /** |
| 41 | 58 | * Setup search functionality |
| @@ -42,9 +59,9 @@ | ||
| 42 | 59 | * |
| 43 | 60 | * @since 3.1 |
| 44 | 61 | */ |
| 45 | 62 | public function setup() { |
| 46 | - Indexables::factory()->register( new Indexable\Term\Term() ); | |
| 63 | + Indexables::factory()->activate( 'term' ); | |
| 47 | 64 | |
| 48 | 65 | add_action( 'init', [ $this, 'search_setup' ] ); |
| 49 | 66 | } |
| 50 | 67 | |
| @@ -58,19 +75,8 @@ | ||
| 58 | 75 | add_filter( 'ep_term_fuzziness_arg', [ $this, 'set_admin_terms_search_fuzziness' ] ); |
| 59 | 76 | } |
| 60 | 77 | |
| 61 | 78 | /** |
| 62 | - * Output feature box long text | |
| 63 | - * | |
| 64 | - * @since 3.1 | |
| 65 | - */ | |
| 66 | - public function output_feature_box_long() { | |
| 67 | - ?> | |
| 68 | - <p><?php esc_html_e( 'This feature will empower your website to overcome traditional WordPress term search and query limitations that can present themselves at scale.', 'elasticpress' ); ?></p> | |
| 69 | - <?php | |
| 70 | - } | |
| 71 | - | |
| 72 | - /** | |
| 73 | 79 | * Enable integration on search queries |
| 74 | 80 | * |
| 75 | 81 | * @param bool $enabled Whether EP is enabled |
| 76 | 82 | * @param \WP_Term_Query $query Current query object. |
| @@ -97,9 +103,9 @@ | ||
| 97 | 103 | * @since 3.1 |
| 98 | 104 | * @return FeatureRequirementsStatus |
| 99 | 105 | */ |
| 100 | 106 | public function requirements_status() { |
| 101 | - $status = new FeatureRequirementsStatus( 1 ); | |
| 107 | + $status = new FeatureRequirementsStatus( 1, null, $this ); | |
| 102 | 108 | |
| 103 | 109 | return $status; |
| 104 | 110 | } |
| 105 | 111 | |
| @@ -115,6 +121,5 @@ | ||
| 115 | 121 | $fuzziness = 0; |
| 116 | 122 | } |
| 117 | 123 | return $fuzziness; |
| 118 | 124 | } |
| 119 | - | |
| 120 | 125 | } |