Home

Custom content type with mimetype constraint

You are here

5 posts / 0 new
Last post
Custom content type with mimetype constraint

Hi,

I'm having trouble getting my head around this. Is it possible to create a custom type which has constraints on the mimetype of the content. For example, a content type which can only have "application/pdf" as its content mimetype? I realize this can be accomplished at the application-level during content creation, but I am curious if the model could enforce this.

Any hints would be appreciated.

Carlos S. Zamudio

4.2.e

Carlos S. Zamudio

no

I'am afraid there is no such feature in model level.

If this post was helpful, please click Yes on the Post Rating

overrides

Hi Carlos,

it should be possible to add a constraint in the model, e.g.

<type name="foo:bar">
<parent name="cm:content"/>
<overrides>
<property cm:mimrtype>
<constraints>
<constraint type="REGEX">
<property name="expression" value="application/pdf">
</c onstraint>
</constraints>
</property>
</overrides>
</type>

(not having my dev environment at hand -- the syntax may be slightly incorrect, but you should get the idea)

BUT: mime type is typically something managed by the system, so you'll have to check whether this will provide you with what you need:

  • if mime type is not PDF, the system should not let you change type into your content type foo:bar
  • if content type of the object is foo:bar, the system should not let you change the mime type to anything other than PDF
  • there may be other cases that need consideration...

iPirat
If this post was helpful, please click "mark comment as useful"

Thanks for the suggestion. I

Thanks for the suggestion. I tried something similar, but I'll experiment with different forms of the property name and if I find something that works, I'll post it. Cheers.

Carlos S. Zamudio

property overrided

I don't think iPirat'solution will work,because:
"cm:mimetype" is not a property of "cm:cotent type" and the overrided logic will not work on it.
Correct me if I'm wrong

If this post was helpful, please click Yes on the Post Rating