Skip to content

Commit

Permalink
Add filter and method to enqueue widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
steveush committed Dec 27, 2024
1 parent c6d25b5 commit 670ca2d
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions includes/class-fooconvert-display-rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -712,12 +712,13 @@ public function render_enqueued() {
* @since 1.0.0
*/
public function enqueue_required() {
$this->enqueued = apply_filters( 'fooconvert_enqueue_required', array() );

//todo: add to these exclusions to limit the overhead on the server
if ( is_admin() || wp_is_json_request() ) {
if ( empty( $this->enqueued ) && ( is_admin() || wp_is_json_request() ) ) {
return;
}

$this->enqueued = array();
// get the cached display rules
$display_rules = get_option( 'fooconvert_display_rules', array() );
if ( ! empty( $display_rules ) ) {
Expand All @@ -742,6 +743,19 @@ public function enqueue_required() {
}
}

public function get_queueable( int $post_id ) : array {
$content = get_post_field( 'post_content', $post_id );
if ( ! empty( $content ) ) {
$compatibility_mode = FooConvert::plugin()->compatibility->is_enabled( $post_id );
return array(
'post_id' => $post_id,
'content' => do_blocks( $content ),
'compatibility_mode' => $compatibility_mode,
);
}
return array();
}

/**
* Check if the given compiled display rules match the current location and user roles.
*
Expand Down

0 comments on commit 670ca2d

Please sign in to comment.