vivomedia/neos-simple-table

Neos CMS 的简单 Html-Table NodeType

3.1.0 2023-12-14 15:11 UTC

This package is auto-updated.

Last update: 2024-09-14 17:48:20 UTC


README

Latest Stable Version Total Downloads License Maintainability

VIVOMEDIA Neos-Simple-Table

Neos CMS 的简单 Html-Table NodeType.

它提供的内容

轻松在 Neos CMS 中添加 Table-NodeType。

目前你可以提供以 CSV 字符串 的形式的数据。这将被解析并渲染为 HTML 表格。

选择是否需要渲染表头行和/或高亮列。

安装

通过 composer 安装

composer require vivomedia/neos-simple-table

使用方法

只需将格式良好的 CSV(以分号 (;) 为分隔符)添加到检查器的数据字段中。选择您的数据是否包含任何标题数据,以及是否需要高亮第一列。您还可以为您的表格添加标题。

扩展

向结果表格添加属性

向表格添加类

prototype(VIVOMEDIA.SimpleTable:HtmlTable) {
  attributes.class {
    table = 'table'
    striped = 'table-striped'
  }
}

向表头添加类

prototype(VIVOMEDIA.SimpleTable:HtmlTableHead) {
  attributes.class {
    something = 'something-special'
  }
}

在单元格中渲染图标或其他特殊内容

您可以在自定义 Fusion 中添加一些自定义占位符并将它们替换掉。例如,将所有 {true}{false} 关键字替换为图标

prototype(VIVOMEDIA.SimpleTable:HtmlTableColumn) {

  content {

    isTrue {
      condition = ${item == '{true}'}
      renderer = Neos.Fusion:Tag) {
        tagName = 'img'
        attributes.src = Neos.Fusion:ResourceUri {
          path = 'resource://VIVOMEDIA.SitePackage/Public/icons/checked.svg'
        }
      }
    }

    isFalse {
      condition = ${item == '{false}'}
      renderer = Neos.Fusion:Tag) {
        tagName = 'img'
        attributes.src = Neos.Fusion:ResourceUri {
          path = 'resource://VIVOMEDIA.SitePackage/Public/icons/unchecked.svg'
        }
      }
    }
  }

截图

Inspector Resulting table