定制 magently/module-content-setup 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

magently/module-content-setup

Composer 安装命令:

composer require magently/module-content-setup

包简介

Magently Content Setup module for Magento 2.

README 文档

README

Installation

To install the module, run the following commands:

composer require magently/module-content-setup
php bin/magento setup:upgrade

Usage

Now you can use the module in your code. Inject Magently\ContentSetup\Model\ContentSetupFactory in your UpgradeData / PatchData class - a Factory is used here so that you can use this module in different modules in the project, for example:

  public function __construct(\Magently\ContentSetup\Model\ContentSetupFactory $contentSetupFactory)
  {
      $this->contentSetupFactory = $contentSetupFactory;
  }

Then create an object from a Factory passing the name of your module, for example:

/** @var \Magently\ContentSetup\Model\ContentSetup $setup */
$setup = $this->contentSetupFactory->create(['moduleName' => 'Magently_TestModule']);

From now on, you can use the module to upload your content:

$setup->setupPage('test_page');
$setup->setupBlock('test_block');
$setup->setupEmailTemplate('test_email');
$setup->setupVariable('test_variable', 'TEST VARIABLE');

Cms Pages, Cms Blocks and Email Templates must be placed in the structure of your module: app/code/VendorName/ModuleName/Setup/Content/{COMPONENT_NAME}, e.g. app/code/Magently/TestModule/Setup/Content/Block/test_block.html and app/code/Magently/TestModule/Setup/Content/Block/test_block.php

files will be used to create / update a block with a test_block identifier. Put the content of the block in the .html file. In the .php file, put the data as an array with keys such as name or is_active:

// file: app/code/Magently/TestModule/Setup/Content/Block/test_block.php
<?php

return [
    'title' => 'Magently Test Block',
    'identifier' => 'test_block',
    'is_active' => 1
];

Declare Magento Variables as below, without any files:

    public function setupVariable(
        string $code,
        string $name = null,
        string $plainValue = null,
        string $htmlValue = null
    )

More information

You can find more about how the module works on our Magently blog: https://magently.com/blog/add-magento-cms-blocks-programmatically

In case of problems or ideas on how to improve the module, don't hestiate to open a pull request.

magently/module-content-setup 适用场景与选型建议

magently/module-content-setup 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.67k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2022 年 08 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 magently/module-content-setup 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 magently/module-content-setup 我们能提供哪些服务?
定制开发 / 二次开发

基于 magently/module-content-setup 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.67k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 16
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: OSL-3.0
  • 更新时间: 2022-08-26