Last active
April 21, 2016 13:57
-
-
Save bueltge/e395766c2a86f5f5c0d31237c6aeb616 to your computer and use it in GitHub Desktop.
WordPress Antipattern, no good classes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // @see http://dnaber.de/blog/2015/wordpress-antipattern-filter-im-constructor-zuweisen/ | |
| class MetaBoxRegistrar { | |
| private $metaBox; | |
| public function __construct( MetaBoxInterface $metaBox ) { | |
| $this->metaBox = $metaBox; | |
| } | |
| public function register() { | |
| add_action( | |
| 'add_meta_boxes', | |
| [ $this->metaBox, 'addMetaBox' ] | |
| ); | |
| add_action( | |
| 'save_post', | |
| [ $this->metaBox, 'savePost' ] | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Artikel, Quelle http://dnaber.de/blog/2015/wordpress-antipattern-filter-im-constructor-zuweisen/