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
elasticpress / includes / classes / Feature / Facets / Block.php

Block.php in ElasticPress 5.3.5, at includes/classes/Feature/Facets/Block.php

56 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Abstract Facet Block class.
4 *
5 * @since 4.7.0
6 * @package elasticpress
7 */
8
9 namespace ElasticPress\Feature\Facets;
10
11 /**
12 * Abstract Facet Block class.
13 */
14 abstract class Block {
15
16 /**
17 * Setup hooks and filters for facet block.
18 */
19 abstract public function setup();
20
21 /**
22 * Register facet block.
23 */
24 abstract public function register_block();
25
26 /**
27 * Render the block.
28 *
29 * @param array $attributes Block attributes.
30 * @return string
31 */
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 }
55 }
56