Skip to content

Commit

Permalink
Fixing the inclusion of the content models. (important)
Browse files Browse the repository at this point in the history
  • Loading branch information
krugazul committed Jan 30, 2025
1 parent e2c4f24 commit 52fd854
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ vendor/.DS_Store
.DS_Store
vendor/.DS_Store
vendor/.DS_Store
vendor/.DS_Store
3 changes: 2 additions & 1 deletion includes/classes/class-tour-operator.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function __construct() {
// init legacy.
$this->legacy = legacy\Tour_Operator::get_instance();
// Setup plugin.
add_action( 'init', array( $this, 'setup' ), 10 );
add_action( 'init', array( $this, 'setup' ), 9 );
}

/**
Expand Down Expand Up @@ -227,6 +227,7 @@ public function setup() {
$this->patterns = new Patterns();
$this->templates = new Templates();

do_action( 'qm/debug', $this->templates );

// Files that wont load with the badly written spl_autoregister function.
require_once LSX_TO_PATH . 'includes/classes/class-post-connections.php';
Expand Down
Binary file modified vendor/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,21 @@ public static function maybe_register_content_models_from_json() {
return;
}

$post_types = glob( CONTENT_MODEL_JSON_PATH . '/post-types/*.json' );
$post_types = array_map(
fn( $file ) => json_decode( file_get_contents( $file ), true ),
$post_types
);
global $CONTENT_MODEL_JSON_PATH;
if ( ! isset( $CONTENT_MODEL_JSON_PATH ) ) {
return;
}

$post_types = [];

foreach ( $CONTENT_MODEL_JSON_PATH as $json_path ) {
$types = glob( $json_path . '/post-types/*.json' );
$types = array_map(
fn( $file ) => json_decode( file_get_contents( $file ), true ),
$types
);
$post_types = array_merge( $post_types, $types );
}

self::register_content_models_from_json( $post_types );
self::delete_dangling_content_models( $post_types );
Expand Down

0 comments on commit 52fd854

Please sign in to comment.