digicomp/asset-attributes

媒体资产的属性

1.0.1 2023-07-25 17:56 UTC

This package is auto-updated.

Last update: 2024-09-25 20:41:20 UTC


README

Build status

此包允许您通过自定义属性扩展 Neos 媒体资产。

此扩展将覆盖 neos/media-browser 的原始编辑模板 - 这样您就可以在经典资产编辑器中获得所有自定义属性和匹配的表单字段。

您可以通过将它们添加到您的 Settings.yaml 来添加新属性

DigiComp:
  AssetAttributes:
    customAssetProperties:
      author:
        type: 'textarea' # or empty for textfields
        position: 'end'

每个资产实例将获得一个“属性”属性,您可以使用 PHP 或 DQL 与之交互。

示例

  • 处理资产实例

      $assetObject->getAttributes()->set($key, new AssetAttribute($key, $value));
    
  • 使用 DQL 查询

      SELECT att FROM Neos\Media\Domain\Model\Asset a JOIN a.attributes att 
    
  • 处理查询对象

      $query = new \Neos\Flow\Persistence\Doctrine\Query(\Neos\Media\Domain\Model\Asset::class);
      $query->setOrderings(['attributes.value' => \Neos\Flow\Persistence\QueryInterface::ORDER_ASCENDING]);