Question

I was creating custom content model

in datalistModel.xml

 <type name="dl:car">
     <title>Car List</title>
     <parent>dl:dataListItem</parent>
     <properties>
        <property name="dl:carName">
           <title>Car Name</title>
           <type>d:text</type>
           <mandatory>false</mandatory>
        </property>
        <property name="dl:carCompany">
           <title>Company Name</title>
           <type>d:text</type>
           <mandatory>false</mandatory>
        </property>
     </properties>
  </type>

in share-datalist-form-config.xml

   <!-- dl:contact type create car form -->
   <config evaluator="model-type" condition="dl:car">
      <forms>
         <!-- Create item form -->
         <form>
            <field-visibility>
               <!-- dl:contact type -->
               <show id="dl:carName" />
               <show id="dl:carCompany" />
            </field-visibility>
            <create-form template="../data-lists/forms/dataitem.ftl" />
         </form>
      </forms>
   </config> 

When I create a new car content in repository browser(I later configured menu to add content type 'Car'), the file name is 91b65385-86c6-4923-859d-6ecb3326319c.

     <create-content>
         <content id="plain-text" mimetype="text/plain" label="create-content.text" itemid="cm:content" icon="text"/>
         <content id="html" mimetype="text/html"  label="create-content.html" itemid="cm:content"/>
         <content id="xml" mimetype="text/xml" label="create-content.xml" itemid="cm:content"/>
         <content id="car" mimetype="text/xml" icon="xml" label="create-content.car" itemid="dl:car"/>         
      </create-content>

How can I make the file name to carName instead of 91b65385-86c6-4923-859d-6ecb3326319c

Any kind help is appreciated.

Was it helpful?

Solution

Take a look at the default 'share-datalist-form-config.xml'

You will see that almost every type specify <show id="cm:title" />

You could also just put <show id="name" /> or <show id="cm:name" /> to show the name attribute.

In order to put the title you will need to put the cm:titled aspect in your model.

Just check the 'datalistModel.xml' how the defaults are defined

And check this blog post to know a bit more how to create custom datalists.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top