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

Override the default "App" namespace #6

Open
jt-adwisemedia opened this issue Mar 25, 2020 · 0 comments
Open

Override the default "App" namespace #6

jt-adwisemedia opened this issue Mar 25, 2020 · 0 comments
Assignees

Comments

@jt-adwisemedia
Copy link

Summary

We're trying to use blade-generate, but we're getting this error
Error: You don't appear to have installed or activated Sage 9!

I then took a quick look in the package and it appears that you're looking for the App\sage namespace\function.

We're using a heavily customized theme where we've overridden the default App namespace,
which is fully supported in the Sage theme.

Even some packages like soberwp have added wordpress filters to allow users/themes to override the default namespace.

Potential Solution / Examples

../vendor/soberwp/controller/controller.php:

 10  function sage()
 11  {
 12      // Determine if project namespace has been changed
 13      sage = apply_filters('sober/controller/sage/namespace', 'App') . '\sage';
 14  
 15      // Return the function if it exists
 16      if (function_exists($sage)) {
 17          return $sage;
 18      }
 19  
 20      // Return false if function does not exist
 21      return false;
 22  }

../vendor/soberwp/controller/src/Loader.php:

 60  protected function setNamespace()
 61  {
 62      $this->namespace =
 63          (has_filter('sober/controller/namespace')
 64          ? apply_filters('sober/controller/namespace', rtrim($this->namespace))
 65          : 'App\Controllers');
 66  }

Is it possible for you to make a similar solution with filters for this package?

I haven't personally worked with WP_CLI before so i don't know if you have full access to WordPress function or not, like apply_filters();

Not including any dev environments such as PHP version etc since this is more of a logical issue.

@jt-adwisemedia jt-adwisemedia changed the title Override "App" namespace Override the default "App" namespace Mar 25, 2020
@alwaysblank alwaysblank self-assigned this Oct 20, 2020
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

2 participants