Allow theme-included ACF Pro as requirement

This commit is contained in:
Cooper Dalrymple
2025-08-01 10:53:24 -05:00
parent 9a758ba545
commit 52a49a53e8
2 changed files with 5 additions and 5 deletions

View File

@@ -38,7 +38,7 @@ abstract class PluginBase {
add_action('init', [$this, 'setup_textdomain']); add_action('init', [$this, 'setup_textdomain']);
// Requirements Check // Requirements Check
add_action('plugins_loaded', [$this, 'check_requirements'], 1, 0); add_action('after_setup_theme', [$this, 'check_requirements'], 1, 0);
$this->enable(); $this->enable();
} }
@@ -46,11 +46,11 @@ abstract class PluginBase {
// Plugin Initialization // Plugin Initialization
protected function enable() { protected function enable() {
add_action('plugins_loaded', [$this, 'load'], 10, 0); add_action('after_setup_theme', [$this, 'load'], 10, 0);
add_filter('acf/settings/load_json', [$this, 'register_acf_json'], 10, 1); add_filter('acf/settings/load_json', [$this, 'register_acf_json'], 10, 1);
} }
protected function disable() { protected function disable() {
remove_action('plugins_loaded', [$this, 'load'], 10, 0); remove_action('after_setup_theme', [$this, 'load'], 10, 0);
remove_filter('acf/settings/load_json', [$this, 'register_acf_json'], 10, 1); remove_filter('acf/settings/load_json', [$this, 'register_acf_json'], 10, 1);
} }

View File

@@ -36,8 +36,8 @@ class Plugin extends PluginBase {
$this->add_requirement('advanced-custom-fields', [ $this->add_requirement('advanced-custom-fields', [
'name' => 'Advanced Custom Fields PRO', 'name' => 'Advanced Custom Fields PRO',
'url' => 'https://www.advancedcustomfields.com/', 'url' => 'https://www.advancedcustomfields.com/',
'type' => self::REQUIREMENT_PLUGIN, 'type' => self::REQUIREMENT_CLASS,
'plugin' => 'advanced-custom-fields-pro/acf.php', 'class' => '\ACF',
]); ]);
$this->add_files([ $this->add_files([