Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error when running CLI command #1

Open
alleknalle opened this issue Jan 11, 2024 · 0 comments
Open

Fatal error when running CLI command #1

alleknalle opened this issue Jan 11, 2024 · 0 comments

Comments

@alleknalle
Copy link

Hi there,

Thank you for the password add-on for Carbon Fields :-)
In Wordpress it works like a charm!

But when I run a CLI command in my plugin I'm getting the following error:

Fatal error: Uncaught Error: Call to undefined function Carbon_Fields\Provider\add_filter() in\vendor\htmlburger\carbon-fields\core\Provider\Container_Condition_Provider.php on line 254

When I looked this up in Google it looks like there is an issue that the function in Carbon Fields is called, while Wordpress is not (since I'm not using Bedrock or anything, just the 'simple' download Wordpress and unzip).
It looks like the function is called because field.php in this plugin is autoloaded through Composer and thus the code runs without knowing anything of Wordpress.
See htmlburger/carbon-fields#899 and htmlburger/carbon-field-icon#11

I think the best way to load the custom field would be to not autoload the file, but create a class with a static function (that the user of the field has to manually call) to load the custom field. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant