| @@ -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,19 +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 | - Indexables::factory()->register( new Indexable\Term\Term(), false ); | |
| 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>'; | |
| 38 | 53 | |
| 39 | - parent::__construct(); | |
| 54 | + $this->docs_url = __( 'https://www.elasticpress.io/resources/articles/configuring-elasticpress-via-the-plugin-dashboard/#terms', 'elasticpress' ); | |
| 40 | 55 | } |
| 41 | 56 | |
| 42 | 57 | /** |
| 43 | 58 | * Setup search functionality |
| @@ -60,19 +75,8 @@ | ||
| 60 | 75 | add_filter( 'ep_term_fuzziness_arg', [ $this, 'set_admin_terms_search_fuzziness' ] ); |
| 61 | 76 | } |
| 62 | 77 | |
| 63 | 78 | /** |
| 64 | - * Output feature box long text | |
| 65 | - * | |
| 66 | - * @since 3.1 | |
| 67 | - */ | |
| 68 | - public function output_feature_box_long() { | |
| 69 | - ?> | |
| 70 | - <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> | |
| 71 | - <?php | |
| 72 | - } | |
| 73 | - | |
| 74 | - /** | |
| 75 | 79 | * Enable integration on search queries |
| 76 | 80 | * |
| 77 | 81 | * @param bool $enabled Whether EP is enabled |
| 78 | 82 | * @param \WP_Term_Query $query Current query object. |
| @@ -99,9 +103,9 @@ | ||
| 99 | 103 | * @since 3.1 |
| 100 | 104 | * @return FeatureRequirementsStatus |
| 101 | 105 | */ |
| 102 | 106 | public function requirements_status() { |
| 103 | - $status = new FeatureRequirementsStatus( 1 ); | |
| 107 | + $status = new FeatureRequirementsStatus( 1, null, $this ); | |
| 104 | 108 | |
| 105 | 109 | return $status; |
| 106 | 110 | } |
| 107 | 111 | |
| @@ -117,6 +121,5 @@ | ||
| 117 | 121 | $fuzziness = 0; |
| 118 | 122 | } |
| 119 | 123 | return $fuzziness; |
| 120 | 124 | } |
| 121 | - | |
| 122 | 125 | } |