Getbeans / Beans

Beans WordPress Theme Framework. The default branch is set to development, please switch to the master branch for production.
https://www.getbeans.io
Other
391 stars 61 forks source link

Extend Filters API and Create a Hooks API #106

Open hellofromtonya opened 6 years ago

hellofromtonya commented 6 years ago

Actions API has an awesome collection of functionality that lets us do a smart add, modify, remove, replace, and reset. These functions truly are the missing components for the WordPress Plugin API.

Let's enhance the Filters API to add all of these functions.

I propose:

  1. Adding a Hooks API and rolling both the Actions and Filters into this one API.
  2. Moving the private functions into either class to hide away the complexity.
  3. Removing the global variable $_beans_registered_actions.
  4. Creating a container within the new class that replaces the global $_beans_registered_actions.
  5. Refactoring like functionality between the actions and filter.
  6. Removing _Beans_Anonymous_Actions and _Beans_Anonymous_Filters (needed for PHP 5.2)
  7. Replacing those classes with closures.
  8. Moving the existing code into the new (not yet built) Beans v1.5 plugin, which provides the backwards-compatibility for child themes running on Beans < 2.0.
hellofromtonya commented 6 years ago

I'd also suggest that we build it as a module and then submit it to Composer. This will allow non-Beans powered sites to utilize the Beans Hooks API.

Seriously, this is a really cool API and the missing functionality within Core. I think the WordPress Community is going to want this baby even if they are not using a Beans powered theme.