Last active
December 27, 2024 08:33
-
-
Save pkosciak/21511606bd919d59d8cae7f76188dff3 to your computer and use it in GitHub Desktop.
Tinkerwell driver for bedrock
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
| <?php | |
| /* Put this file inside .tinkerwell directory in your bedrock project */ | |
| use Tinkerwell\ContextMenu\Label; | |
| class BedrockTinkerwellDriver extends TinkerwellDriver | |
| { | |
| public function canBootstrap($projectPath) | |
| { | |
| return file_exists($projectPath . '/web/wp/wp-load.php'); | |
| } | |
| public function bootstrap($projectPath) | |
| { | |
| putenv('APP_RUNNING_IN_CONSOLE=false'); | |
| require $projectPath . '/web/wp/wp-load.php'; | |
| } | |
| public function getAvailableVariables() | |
| { | |
| return [ | |
| '__blog' => get_bloginfo() | |
| ]; | |
| } | |
| public function contextMenu() | |
| { | |
| return [ | |
| Label::create('Detected Bedrock v' . get_bloginfo('version')), | |
| ]; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment