Skip to content

Custom Properties? #264

@erkenes

Description

@erkenes

Hi,

is there a way to add custom properties to the asset view and make them editable?

Image

I'm extending the Assets with a trait and need to make the properties changeable through the backend.

<?php
use Doctrine\ORM\Mapping as ORM;

trait AssetTrait
{
    /**
     * @var string|null
     * @ORM\Column(nullable=TRUE)
     */
    protected ?string $someProperty = null;

    /**
     * @return string|null
     */
    public function getSomeProperty(): ?string
    {
        return $this->ePaperUri;
    }

    /**
     * @param string|null $someProperty
     * @return Audio|AssetTrait|Document|Image|Video
     */
    public function setSomeProperty(?string $someProperty): self
    {
        $this->someProperty = $someProperty;
        return $this;
    }
}

and the asset models

<?php
/** @Flow\Entity */
class Image extends \Neos\Media\Domain\Model\Image
{
    use AssetTrait;
}
<?php
/** @Flow\Entity */
class Audio extends \Neos\Media\Domain\Model\Audio
{
    use AssetTrait;
}
<?php
/** @Flow\Entity */
class Document extends \Neos\Media\Domain\Model\Document
{
    use AssetTrait;
}
<?php
/** @Flow\Entity */
class Video extends \Neos\Media\Domain\Model\Video
{
    use AssetTrait;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions