magehack / autogrid
Magehack_Autogrid可以为您的简单或复杂网格完成大部分工作。
1.0.0
2017-02-13 12:50 UTC
Suggests
- magento-hackathon/magento-composer-installer: Allows to manage this package as a dependency
This package is auto-updated.
Last update: 2024-09-22 02:43:26 UTC
README
每当开发人员需要在Magento管理后台显示数据库表的详细信息时,她都必须反复编写相同的代码。Magehack_Autogrid可以为您完成大部分工作,只要网格处理的是扁平表。
事实
- 版本:检查config.xml
- Magento Connect 1.0扩展密钥:无
- Magento Connect 2.0扩展密钥:无
- GitHub上的扩展
- 直接下载链接
描述
每当开发人员需要在Magento管理后台显示数据库表的详细信息时,她都必须反复编写相同的代码。Magehack_Autogrid会自动完成大部分工作,只要网格处理的是扁平表。
它只需要一个非常小的配置文件(比如,5行XML,不包括根节点),其余的自动处理。
此代码位于模块目录中的etc/autogrid.xml文件中。
<config>
<tables>
<example_product_table>
<table>catalog/product</table>
</example_product_table>
</tables>
</config>
当然,还可以指定其他选项,以覆盖默认值
<config>
<tables>
<example_product_table>
<table>catalog/product</table>
<title>Autogrid Example Table</title>
<grid>
<entity_type_id>
<sortable>0</sortable>
</entity_type_id>
<has_options>
<source_model>magehack_autogrid/table_column_source_yesno</source_model>
</has_options>
<type_id>
<header>The Product Type</header>
</type_id>
</grid>
<form>
<type_id>
<disabled>1</disabled>
</type_id>
</form>
</example_product_table>
</tables>
</config>
请参阅etc/autogrid.xml文件中的示例,了解更多示例。
此外,还可以在通常的config.xml文件中指定基于列名的全局默认值
<config>
<adminhtml>
<autogrid>
<column_defaults>
<attribute_set_id>
<frontend_input>select</frontend_input>
<source_model>magehack_autogrid/table_column_source_attributeSetId</source_model>
</attribute_set_id>
<website_ids>
<frontend_input>multiselect</frontend_input>
<source_model>magehack_autogrid/table_column_source_websiteId</source_model>
</website_ids>
<created_at>
<disabled>1</disabled>
</created_at>
</column_defaults>
</autogrid>
</adminhtml>
</config>
它具有许多优点,例如支持扁平表实体的后端模型。
<config>
<tables>
<example_product_table>
<form>
<updated_at>
<backend_model>magehack_autogrid/table_column_backend_updatedAt</backend_model>
</updated_at>
</form>
</example_product_table>
</tables>
</config>
扩展稳定性
扩展的源代码仍然显示出它起源于一个夜间黑客马拉松的根源,但工作仍在继续,它现在处于可用和相对易于维护的状态。
还有很多工作可以完成
使用方法
- 安装Magehack_Autogrid模块
- 使用设置脚本按常规在您的模块中创建表
- 在您的模块etc/目录中创建autogrid.xml文件(语法即将推出)
模块将读取数据库表并猜测网格的默认行为(很快也将包括表单)。
兼容性
- Magento >= 1.7(可能也适用于更早的版本)
安装说明
如果您正在使用Magento编译器,请在安装前禁用编译,并在模块安装后再次运行编译器。
- 从GitHub安装扩展(它不在Magento Connect上)。
- 清除缓存,从管理面板注销,然后再次登录。
待办事项
以下是我目前心中的一些待办事项列表
- 添加每个表的acl资源支持
- 添加更多测试
- 进一步重构列类,列类型应根据抽象列类型分别作为类
- 完成“所有表”网格支持(查看选定的表,创建、编辑和删除表内容)
- 移除示例autogrid.xml
- 创建示例
支持
如果您对此扩展有任何问题,请在GitHub上打开一个问题(见上面的URL)
贡献
任何贡献都备受赞赏。提交代码的最佳方式是在GitHub上发起一个拉取请求。