microman/kirby-grid-blocks

使用布局字段作为块

安装次数: 1,845

依赖: 0

建议: 0

安全: 0

星星: 28

关注者: 4

分支: 1

类型:kirby-plugin

1.0.0 2021-10-05 10:11 UTC

This package is auto-updated.

Last update: 2024-09-18 14:50:37 UTC


README

概述

使用此插件,您可以直接在任何块字段中使用布局!🤗

以下截图显示了其最基本的使用案例

Grid block

此插件免费使用,并发布在MIT许可下。如果您想以商业目的使用此插件并希望表达感谢,请毫不犹豫地通过 捐赠 或通过 我的联盟链接 购买您的许可证。

安装

下载并将此存储库复制到您的插件文件夹: /site/plugins/

Composer

composer require microman/kirby-grid-blocks

前端块字段使用

<?php foreach ($page->myGrid()->toBlocks() as $grid): ?>
  <h2><?= $grid->title() ?></h2>

  <!--
  Customize the Grid-Block and use any custom fields:
  <?= $grid->yourCustomFields() ?>
  -->

  <?= $grid ?>
<?php endforeach ?>

定制

网格块

简单地将 grid.ymlsite/plugins/grid-block/blueprints/blocks 复制到您的项目的 site/blueprints/blocks 文件夹。后者将由 Kirby 使用,而不是由插件提供的。

当然,您可以根据需要对其进行定制

textContent:
  label: Content with Text
  type: blocks
  fieldsets:
    grid:
      extends: blocks/grid
      fields:
        grid:
          layouts:
            - "1/1"
          fieldsets:
            - heading
            - text
        title:
          label: Title
        margin:
          type: range
          after: px
          default: "5"
          min: 0
          max: 200

您可以在上面的截图中找到此示例蓝图的描述。

片段

将块片段 grid.phpsite/plugins/grid-block/snippets/blocks 复制到您的项目的 site/snippets/blocks 文件夹。后者将由 Kirby 使用,而不是由插件提供的。

许可证

MIT

买我一杯☕️

购买 Kirby 许可证 💳