Tinkerwell 4 is out now! See what's new or buy now.
Tinkerwell background image
Tinkerwell Logo Tinkerwell
Hey! You are currently looking at the documentation for Tinkerwell 2. The latest version of the documentation is available here.

Custom context menu
#

You can customize the application context menu and add custom entries to it.

To get started, create a folder called .tinkerwell in the application directory where you want to customize the context menu.

Then you can create a new file called CustomTinkerwellDriver.php.

This is how the default content could look like:

 
use Tinkerwell\ContextMenu\SetCode;
use Tinkerwell\ContextMenu\Separator;
 
class CustomTinkerwellDriver extends LaravelTinkerwellDriver
{
 
public function contextMenu()
{
return array_merge(parent::contextMenu(), [
Separator::create(),
 
SetCode::create('My custom entry', <<<'code'
// Hello from Tinkerwell!
// This code will be preselected when you choose this context menu entry
code),
]);
}
 
}

Depending on which framework/application your app is based on, you will need to extend the correct Tinkerwell driver. You can find a list of all available Tinkerwell drivers on GitHub.

Available context menu items:
#

Separator
#

A separator in the context menu.

Separator::create();

Label
#

A simple label that displays textual information in the context menu:

Label::create('This is the label text');

The OpenURL class can be used to open a specific URL in the browser, once the user clicks on it.

OpenURL::create('Documentation', 'https://tinkerwell.app');

Code Snippets
#

The SetCode class can be used to automatically pre-fill the Tinkerwell code area with specific code snippets. The code will not automatically be executed.

SetCode::create('Hello World', 'echo "Hello world";');

Last but not least you can group multiple context items into a Submenu.

Submenu::create('This is a submenu', [
Label::create('Entry 1'),
Label::create('Entry 2'),
Label::create('Entry 3')
]);