netlogix/assetmetadata

该包的最新版本(2.1.0)没有提供许可证信息。

将元数据对象附加到Neos资产

安装次数: 1,962

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 5

分支: 0

公开问题: 0

类型:neos-package

2.1.0 2023-01-31 09:00 UTC

This package is auto-updated.

Last update: 2024-09-20 13:04:02 UTC


README

此包允许您将多个元数据对象附加到资产。

资产自动通过Aspect获得 Netlogix\AssetMetadata\Domain\Model\AssetMetadataAwareInterface,因此您可以简单地调用 $asset->getMetadata('myMetadata')

配置/使用

  1. 创建一个新的Model,它扩展了 Netlogix\AssetMetadata\Domain\Model\AssetMetadata 并具有您希望的性质。
  2. 配置元数据
Netlogix:
  AssetMetadata:
    metadata:
      'mymetadata':
        label: 'My Metadata'
        # Class that implements this Metadata. Must extend AssetMetadata
        className: 'My\Metadata\Domain\Model\MyMetadata'
        # Partial root path that contains the edit partial
        editPartialRootPath: 'resource://My.Metadata/Private/Partials'
        # Partial File to render in Asset Edit View
        # Path must be Package/Resources/Private/Partials/AssetMetadata/<editPartialName>.html
        editPartialName: 'MyMetadata'
        # Neos AssetSource identifiers to which this Metadata configuration should apply
        # If this is unset, the Metadata will be applied to all AssetSources
        assetSources: ['neos', 'my-special-asset-source']
        # Optional position for ordering in the Edit View of an Asset
        position: 'start'
  1. 创建编辑部分
<label for="mymetadata-fieldA">Field A</label>
<f:form.textfield property="{metadataPropertyPath}.fieldA" id="mymetadata-fieldA" placeholder="Foo" type="text"/>
  1. 设置元数据 $asset->setMetadata('mymetadata', new MyMetadata('mymetadata', $asset))
  2. 获取元数据 $asset->getMetadata('mymetadata')