Git Product home page Git Product logo

amcommand's Introduction

a&m command

Command palette in Craft; Because you can

Functionality

When you install this plugin, you'll have the ability to show a command palette when you navigate through the backend in Craft.

You can open the command palette by using the keyboard combination: (command key for Apple users) CTRL + SHIFT + P, or you can use the lightning button that'll be added to the header actions.

Header actions

The command palette will show admin functions if you are logged in as an admin, and all available sections (non Single) that the user has access to.

Command palette

It's equipped with fuzzy search!

Fuzzy search

Use the keyboard arrows (up and down) to navigate to your desired command.

Focus

When you hit the return key or click on a command, the command palette will navigate to the location and show what it's loading.

Loading

You can close the command by either clicking anywhere on the page (besides the command palette) or by pressing the ESC key.

Adding your own commands

If you'd like to add commands for a plugin you're developing, you can use the addCommands hook!

Example

Add this to your main plugin file:

public function addCommands() {
    $commands = array(
        array(
            'name' => 'Search on Google',
            'type' => 'Custom',
            'url'  => 'http://www.google.nl'
        ),
        array(
            'name' => 'My own plugin function in a service',
            'type' => 'Custom',
            'call' => 'yourPluginFunctionName',
            'service' => 'yourPluginServiceName'
        )
    );
    return $commands;
}

That's it! a&m Command Palette will add these two commands.

If you look at the second example, you see a call and service key. These can be used to load a new set of commands.

In your plugin's service yourPluginServiceName (e.g.: amCommand or amCommand_command), you'll create a new function called yourPluginFunctionName. In here you could do the same thing as you see in the example, and just return the new set of commands.

Contact

If you have any questions or suggestions, don't hesitate to contact us. We would like to add more commands to the palette, so if you have any ideas then please let us know!

amcommand's People

Contributors

hubertprein avatar frankzwiers avatar lukeholder avatar

Watchers

Fred Carlsen avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.