loki/magento2-admin-components 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

loki/magento2-admin-components

Composer 安装命令:

composer require loki/magento2-admin-components

包简介

Admin Panel grids and forms created via Loki Components

关键字:

README 文档

README

This Magento 2 module allows for developers to build admin grids and admin forms in the Magento 2 Admin Panel in a faster way. No more ugly UiComponents that nobody understands. Create grids and forms quickly. And gradually add features to them, without getting stuck.

The LokiAdminComponents are based on the Loki Components module which is also used in the LokiCheckout. However, this admin tool shows that the Loki Extension suite can be applied in many more places.

Note that this library makes use of Alpine.js in the Magento Admin Panel. As for CSS, we stick to the native Magento Admin Panel classes instead: Everything looks the same.

Installation

composer require loki/magento2-admin-components
bin/magento module:enable Loki_AdminComponents Loki_Components Loki_CssUtils Loki_Base

Getting started with a grid

First create a module that generates a page in the Admin Panel (etc/module.xml, registration.php, a backend controller action class, perhaps acl.xml and menu.xml).

In your new XML layout file, add the following:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:View/Layout:etc/page_configuration.xsd">
    <update handle="loki_admin_components_grid"/>

    <body>
        <referenceContainer name="content">
            <block
                name="yireo-training.example-admin.grid"
                template="Loki_AdminComponents::grid.phtml">
                <arguments>
                    <argument name="provider" xsi:type="string">
                        Magento\Catalog\Api\ProductRepositoryInterface
                    </argument>
                </arguments>
            </block>
        </referenceContainer>
    </body>
</page>

And you're done. After refreshing the Magento cache, you now have a product grid.

Refer to the documentation for fine-tuning this grid.

Getting started with a form

Again, first create a module that generates a page in the Admin Panel (etc/module.xml, registration.php, a backend controller action class, perhaps acl.xml and menu.xml).

In your new XML layout file, add the following:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:View/Layout:etc/page_configuration.xsd">
    <update handle="loki_admin_components_form"/>

    <body>
        <referenceContainer name="content">
            <block
                name="yireo-training.example-admin.form"
                template="Loki_AdminComponents::form.phtml">
                <arguments>
                    <argument name="provider" xsi:type="string">
                        Magento\Catalog\Api\ProductRepositoryInterface
                    </argument>
                </arguments>
            </block>
        </referenceContainer>
    </body>
</page>

And you're done. After refreshing the Magento cache, you now have a basic product form.

Refer to the documentation for fine-tuning this form.

Examples

As a demo, you could opt to install the following examples:

Screenshot of YireoTraining_ExampleLokiAdminProducts

Features

Grid features

  • Autodetection of columns
  • Search
  • Pagination
  • Sorting columns
  • Custom cell templates
  • Inline editing
  • Filters
  • Mass Actions
  • Custom cell templates
  • ... (more docs coming soon)

Grid provider handlers

  • repository
  • collection
  • array

Form features

  • Autodetection of columns
  • Field-types (select, text, number, datetime, etc) with option to configure more
  • Form actions (Back, Save and Close, Save and Continue, Delete, etc)
  • ... (more docs coming soon)

Documentation

See https://loki-extensions.com/docs/admin-components

Todo

  • Extension Attributes
  • Filesystem navigation
  • Tiles instead of grid layout
  • Delete add confirmation
  • Add custom SearchCriteriaBuilder via repository addons
  • Switch field for enabled/disabled column within grid
  • Export selected to CSV, JSON, XSLX

统计信息

  • 总下载量: 4.39k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 17
  • 点击次数: 1
  • 依赖项目数: 6
  • 推荐数: 0

GitHub 信息

  • Stars: 17
  • Watchers: 3
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: OSL-3.0
  • 更新时间: 2025-07-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固