am-impact/amcommand
Composer 安装命令:
composer require am-impact/amcommand
包简介
Command palette in Craft.
README 文档
README
Command palette in Craft.
Requirements
This plugin requires Craft CMS 3.0.0-RC1 or later.
Installation
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project -
Then tell Composer to load the plugin:
composer require am-impact/amcommand -
In the Control Panel, go to Settings → Plugins and click the “Install” button for Command Palette.
Functionality
If you have ever used Alfred, you know you'll be zipping through the control panel in no time!
You can open the command palette by using the keyboard combination: (command key for Apple users) CTRL + SHIFT + P, or you click on Command in the CP navigation.
Use the keyboard arrows (up and down) to navigate to your desired command. 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. Use (command key for Apple users) CTRL + RETURN (or click) to fire the command in a new window.
Current commands
Default commands
| Command | Description |
|---|---|
| Content: Delete all entries | Delete all entries in one of the available sections. |
| Content: Delete entries | Delete an entry in one of the available sections. |
| Content: Edit entries | Edit an entry in one of the available sections. |
| Content: New entry | Create a new entry in one of the available sections. |
| Dashboard | Redirect. |
| Globals: Edit | Edit one of your globals. |
| Search on Craft | Redirect - Search on Craft with given keywords. |
| Search on StackExchange | Redirect - Search on StackExchange with given keywords. |
| Settings: Assets | Redirect. |
| Settings: Categories | Redirect. |
| Settings: Fields | Redirect. |
| Settings: Fields - Duplicate | Duplicate a field. |
| Settings: Fields - Edit | Edit one of the fields. |
| Settings: Globals | Redirect. |
| Settings: Globals - Global Sets | Edit the settings for one of the globals. |
| Settings: New... | Add something new in the settings... |
| Settings: Plugins | Redirect. |
| Settings: Plugin settings | Edit the settings for one of the enabled plugins |
| Settings: Routes | Redirect. |
| Settings: Sections | Redirect. |
| Settings: Sections - Edit | Edit a section. |
| Settings: Sections - Edit entry type | Edit an entry type of a section. (Field Layout and such) |
| Settings: Users | Redirect. |
| Tasks | Manage Craft tasks. |
| Tools | Use one of the most used tools. |
| Users: Delete users | Delete a user other than your own. |
| Users: Edit users | Edit a user. |
| Users: Login as user | Log in as a different user, and navigate to their dashboard. |
| Users: New user | Create a user. |
| Sign out | End current session. |
| My Account | Redirect. |
Special commands
| Command | Description |
|---|---|
| Content: Compare entry version | Compare the current entry you are viewing in the CP with older versions. |
| Content: Duplicate entry | Duplicate the current entry you are viewing in the CP. |
| Simply type! | You will be able to search in elements directly when you haven't triggered a (deeper command, that returns a new list or such things) command yet. |
Adding your own commands
If you'd like to add commands for a plugin you're developing, register the commands through an event.
Add this at the top of your main plugin file:
use amimpact\commandpalette\events\RegisterCommandsEvent; use amimpact\commandpalette\services\General; use yii\base\Event;
Add this to the init function of your main plugin file:
if (class_exists(General::class)) { Event::on(General::class, General::EVENT_REGISTER_COMMANDS, function(RegisterCommandsEvent $event) { $event->commands[] = [ 'name' => 'Search on Google', 'type' => 'Custom', 'url' => 'http://www.google.nl', 'icon' => [ 'type' => 'font', 'content' => 'plugin' ] ]; $event->commands[] = [ 'name' => 'My own plugin function in a service', 'type' => 'Custom', 'call' => 'yourPluginFunctionName', 'plugin' => 'your-plugin-handle', 'service' => 'yourPluginServiceName' ]; }); }
That's it! The command palette will add these two commands.
If you look at the second example, you see a call, plugin and service key. These can be used to load a new set of commands.
In your plugin's service yourPluginServiceName (e.g.: general), 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!
am-impact/amcommand 适用场景与选型建议
am-impact/amcommand 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 74.12k 次下载、GitHub Stars 达 86, 最近一次更新时间为 2015 年 04 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「plugin」 「cms」 「command」 「Craft」 「craftcms」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 am-impact/amcommand 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 am-impact/amcommand 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 am-impact/amcommand 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP 4.x AdminLTE Theme.
A Wrapper for exec and it's results
Symfony bundle to monitor and execute commands
GraphQL authentication for your headless Craft CMS applications.
Shell command module for PHP.
Set Links with a specific language parameter
统计信息
- 总下载量: 74.12k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 86
- 点击次数: 16
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-04-23
