定制 wedevelopnl/statamic-grid 二次开发

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

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

wedevelopnl/statamic-grid

Composer 安装命令:

composer require wedevelopnl/statamic-grid

包简介

Grid system with sections, rows, and elements for Statamic

README 文档

README

A flexible grid system addon for Statamic with sections, rows, and elements.

Installation

Add the repository to your project's composer.json:

{
    "repositories": [
        {
            "type": "path",
            "url": "addons/wedevelopnl/statamic-grid"
        }
    ]
}

Then require the package:

composer require wedevelopnl/statamic-grid

Publish the fieldsets:

php artisan vendor:publish --tag=statamic-grid

Usage

Option 1: Automatic Rendering

Use the grid:render tag to automatically render your grid:

{{ grid:render }}

With a custom field name:

{{ grid:render :data="my_custom_grid" }}

Option 2: Manual Rendering

For full control, loop through the grid manually using the addon's partials:

{{ grid }}
    {{ partial src="wedevelopnl/statamic-grid::grid/section" }}
{{ /grid }}

Available partials:

  • statamic-grid::grid/section - Renders a section with background color
  • statamic-grid::grid/row - Renders a row with elements
  • statamic-grid::elements/text - Renders a text element (Bard content)
  • statamic-grid::elements/image - Renders an image element

Adding the Grid to Your Blueprint

Import the grid fieldset in your page blueprint:

tabs:
  main:
    fields:
      - import: grid

Structure

The grid system follows this hierarchy:

  • Grid - Container for sections
    • Section - Full-width section with background color (light/dark)
      • Row - Horizontal row spanning the section
        • Elements - Content blocks (text, image, etc.)

Extending

To add custom element types:

  1. Create a fieldset in resources/fieldsets/element_yourtype.yaml
  2. Import it in resources/fieldsets/element.yaml
  3. Create a view at resources/views/vendor/statamic-grid/elements/yourtype.antlers.html

License

MIT

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-12-08