wegmeister/media-properties 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

wegmeister/media-properties

最新稳定版本:1.0.0

Composer 安装命令:

composer require wegmeister/media-properties

包简介

README 文档

README

This package provides additional media properties for Neos CMS, that allow you to choose tags and asset collections from the Media package.

Installation

From within your Site package, run:

composer require --no-update wegmeister/media-properties

Then run the following command in your project root:

composer update

Usage

This package provides presets and data types for tags and asset collections. To use them, add the following lines to your NodeTypes.yaml file:

Multiple Tags / Asset collections
'Vendor.Package:NodeType':
  properties:
    ##
    # Tags
    ##
    tags:
      # either use type or the options preset, not both
      type: array<Neos\Media\Domain\Model\Tag>
      # options:
      #   preset: tags
      ui:
        label: Tags
        inspector:
          group: default
          # Optionally, only show tags that are linked to one of the given asset collections
          editorOptions:
            dataSourceAdditionalData:
              assetCollections:
                - 'Title of Asset collection'

    ##
    # Asset Collections
    ##
    assetCollections:
      # either use type or the options preset, not both
      type: array<Neos\Media\Domain\Model\AssetCollection>
      # options:
      #   preset: assetCollections
      ui:
        label: Asset Collections
        inspector:
          group: default
Single Tag / Asset collection
'Vendor.Package:NodeType':
  properties:
    ##
    # Single Tag
    ##
    tag:
      # either use type or the options preset, not both
      type: Neos\Media\Domain\Model\Tag
      # options:
      #   preset: tags
      ui:
        label: Tag
        inspector:
          group: default
          # Optionally, only show tags that are linked to one of the given asset collections
          editorOptions:
            dataSourceAdditionalData:
              assetCollections:
                - 'Title of Asset collection'
    ##
    # Single Asset Collection
    ##
    assetCollection:
      # either use type or the options preset, not both
      type: Neos\Media\Domain\Model\AssetCollection
      # options:
      #   preset: assetCollections
      ui:
        label: Asset Collection
        inspector:
          group: default

Then use the property in your fusion files:

prototype(Vendor.Package:NodeType) < prototype(Neos.Neos:ContentComponent) {
    # Multiple Tags / Asset Collections
    tags = ${q(node).property('tags')}
    assetCollections = ${q(node).property('assetCollections')}

    # Single Tag / Asset Collection
    tag = ${q(node).property('tag')}
    assetCollection = ${q(node).property('assetCollection')}

    renderer = afx`
        <div>
            <h2>Tags</h2>
            <Neos.Fusion:Loop items={props.tags}>
                <p>{tag.label}</p>

                <!-- 
                    You can access all properties of the tag here, 
                    even loop through the asset collections
                -->
                <Neos.Fusion:Loop items={tag.assetCollections}>
                    <p>Asset Collection: {assetCollection.title}</p>
                </Neos.Fusion:Loop>
            </Neos.Fusion:Loop>

            <!-- Same for asset collections -->

            <!-- Single Tag / Asset Collection -->
            <h2>Single Tag</h2>
            <p>{props.tag.label}</p>

            <h2>Single Asset Collection</h2>
            <p>{props.assetCollection.title}</p>
        </div>
    `
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2025-07-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固