Skip to content

Instantly share code, notes, and snippets.

@pkosciak
Last active December 27, 2024 08:33
Show Gist options
  • Select an option

  • Save pkosciak/21511606bd919d59d8cae7f76188dff3 to your computer and use it in GitHub Desktop.

Select an option

Save pkosciak/21511606bd919d59d8cae7f76188dff3 to your computer and use it in GitHub Desktop.
Tinkerwell driver for bedrock
<?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