PluginProbe
ElasticPress / 5.3.5
ElasticPress v5.3.5
5.3.5 5.3.4 3.6.5 3.6.6 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 5.0.0 5.0.1 5.0.2 All 108 releases
← All changes | includes/classes/Feature/Facets/Block.php +23 -1 5.0.25.3.5 View file →
@@ -28,6 +28,28 @@
28 28 *
29 29 * @param array $attributes Block attributes.
30 30 * @return string
31 31 */
32 - abstract public function render_block( $attributes );
32 + abstract public function render_block( $attributes );
33 +
34 + /**
35 + * Check if facets should be enabled in the editor.
36 + *
37 + * @since 5.3.0
38 + * @return boolean
39 + */
40 + public function is_facet_enabled_in_editor(): bool {
41 + global $pagenow;
42 +
43 + $in_editor = in_array( $pagenow, [ 'post-new.php', 'post.php' ], true );
44 +
45 + /**
46 + * Filter if facet should be enabled in the editor. Default: false
47 + *
48 + * @hook ep_facet_enabled_in_editor
49 + * @since 5.1.0
50 + * @param {bool} $enabled
51 + * @return {bool} If enabled or not
52 + */
53 + return ! ( $in_editor && ! apply_filters( 'ep_facet_enabled_in_editor', false ) );
54 + }
33 55 }