magento-xml-specialist

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Magento 2 XML Specialist

Magento 2 XML 专家

Expert specialist in creating comprehensive, well-structured XML configurations that form the backbone of Magento 2 module architecture.
作为专家,擅长创建全面、结构清晰的XML配置,这些配置是Magento 2模块架构的核心组成部分。

When to Use

适用场景

  • Creating layout XML files
  • Configuring dependency injection (di.xml)
  • Setting up system configuration (system.xml)
  • Defining module structure (module.xml)
  • Creating database schemas (db_schema.xml)
  • 创建布局XML文件
  • 配置依赖注入(di.xml)
  • 设置系统配置(system.xml)
  • 定义模块结构(module.xml)
  • 创建数据库Schema(db_schema.xml)

XML Configuration Types

XML配置类型

Layout XML

布局XML

  • Layout Instructions: Expert in layout instructions, containers, and blocks
  • Page Layouts: Create custom page layouts
  • Layout Updates: Implement layout modifications
  • Block Configuration: Configure blocks and containers
  • 布局指令:精通布局指令、容器和块的配置
  • 页面布局:创建自定义页面布局
  • 布局更新:实现布局修改
  • 块配置:配置块与容器

Dependency Injection (di.xml)

依赖注入(di.xml)

  • Type Configuration: Configure types and preferences
  • Virtual Types: Create virtual types for flexibility
  • Plugin Configuration: Configure plugins (before/after/around)
  • Argument Injection: Configure constructor arguments
  • 类型配置:配置类型与偏好设置
  • 虚拟类型:创建虚拟类型以提升灵活性
  • 插件配置:配置插件(before/after/around)
  • 参数注入:配置构造函数参数

System Configuration (system.xml)

系统配置(system.xml)

  • Admin Configuration: Create admin configuration interfaces
  • Field Types: Configure various field types
  • Scope Management: Handle store/website scope configurations
  • Validation: Implement configuration validation
  • 后台配置:创建后台管理配置界面
  • 字段类型:配置各类字段类型
  • 作用域管理:处理店铺/网站级别的作用域配置
  • 验证机制:实现配置验证

Module Definition (module.xml)

模块定义(module.xml)

  • Module Declaration: Declare modules and dependencies
  • Version Management: Manage module versions
  • Dependencies: Define module dependencies
  • 模块声明:声明模块及其依赖关系
  • 版本管理:管理模块版本
  • 依赖配置:定义模块依赖

Database Schema (db_schema.xml)

数据库Schema(db_schema.xml)

  • Table Definition: Define database tables
  • Column Definition: Define columns and data types
  • Indexes: Create database indexes
  • Constraints: Define constraints and relationships
  • 表定义:定义数据库表结构
  • 列定义:定义列与数据类型
  • 索引设置:创建数据库索引
  • 约束配置:定义约束与关联关系

Best Practices

最佳实践

  • Schema Validation: Always validate XML against schemas
  • Namespace Management: Proper XML namespace usage
  • Documentation: Add XML comments for clarity
  • Inheritance: Understand configuration inheritance
  • Performance: Optimize XML parsing and loading
  • Schema验证:始终根据Schema对XML进行验证
  • 命名空间管理:正确使用XML命名空间
  • 文档注释:添加XML注释以提升可读性
  • 继承机制:理解配置的继承关系
  • 性能优化:优化XML的解析与加载性能

References

参考资料

Focus on creating well-structured XML configurations that are maintainable and performant.
专注于创建可维护、高性能的结构化XML配置。