Skip to content

Commit e30e002

Browse files
committed
Update AssetManager.php
1 parent 7d6e5ee commit e30e002

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

Core/AssetManager.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ class AssetManager
291291
'init-plyr-js' => [
292292
'file' => 'js/initplyr.js',
293293
'deps' => ['jquery', 'embedpress-plyr'],
294-
'contexts' => ['frontend', 'elementor'],
294+
'contexts' => ['editor', 'frontend', 'elementor'],
295295
'type' => 'script',
296296
'footer' => true,
297297
'handle' => 'embedpress-init-plyr',
@@ -683,10 +683,21 @@ private static function should_load_asset($asset)
683683
if (!self::check_asset_condition($asset['condition'])) {
684684
return false;
685685
}
686-
}
687686

688-
// Check provider-specific loading
689-
if (isset($asset['providers']) && !empty($asset['providers'])) {
687+
// When a condition like 'custom_player' already passed, skip the
688+
// provider check — the condition itself proves these scripts are
689+
// needed. Provider detection is fragile (missing URL attrs,
690+
// widget-name typos, etc.) and should not block explicitly-enabled
691+
// features.
692+
if ($asset['condition'] === 'custom_player') {
693+
// Provider check not needed; fall through to context check
694+
} elseif (isset($asset['providers']) && !empty($asset['providers'])) {
695+
if (!self::check_provider_match($asset['providers'])) {
696+
return false;
697+
}
698+
}
699+
} elseif (isset($asset['providers']) && !empty($asset['providers'])) {
700+
// No condition set — still check providers
690701
if (!self::check_provider_match($asset['providers'])) {
691702
return false;
692703
}
@@ -1428,8 +1439,9 @@ private static function detect_types_from_elementor_data($data)
14281439
}
14291440

14301441
// Check if this is an EmbedPress widget
1442+
// Note: widget name is 'embedpres_elementor' (legacy typo without double 's')
14311443
$widget_type = $element['widgetType'] ?? '';
1432-
if ($widget_type && (strpos($widget_type, 'embedpress') !== false || strpos($widget_type, 'Embedpress') !== false)) {
1444+
if ($widget_type && (strpos($widget_type, 'embedpres') !== false || strpos($widget_type, 'Embedpress') !== false)) {
14331445
// Get the embed source
14341446
$settings = $element['settings'] ?? [];
14351447
$source = $settings['embedpress_pro_embeded_source'] ?? '';

0 commit comments

Comments
 (0)