<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to add custom attributes to content in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-add-custom-attributes-to-content/m-p/313863#M864</link>
    <description>&lt;P&gt;To add custom attributes you need to load your own "layouts" which contains your desired attributes. You can add as many fields as u want.&lt;/P&gt;
&lt;P&gt;Create a file layout-contrib.xml file. You can define ur fields through widgets. In nuxeo, each field/attribute is defined through widget. Write your widget in layout-contrib.xml. For example,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;	&amp;lt;extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
	point="layouts"&amp;gt;
    &amp;lt;layout name="My_layout"&amp;gt;

		&amp;lt;templates&amp;gt;
			&amp;lt;template mode="any"&amp;gt;/layouts/layout_default_template.xhtml
			&amp;lt;/template&amp;gt;
		&amp;lt;/templates&amp;gt;
	
		&amp;lt;rows&amp;gt;
			&amp;lt;row&amp;gt;
				&amp;lt;widget&amp;gt;weight_widget&amp;lt;/widget&amp;gt;
			&amp;lt;/row&amp;gt;

     &amp;lt;widget name="weight_widget" type="int"&amp;gt;
        &amp;lt;labels&amp;gt;
				&amp;lt;label mode="any"&amp;gt;Weight &amp;lt;/label&amp;gt;
		&amp;lt;/labels&amp;gt;
			&amp;lt;translated&amp;gt;false&amp;lt;/translated&amp;gt;
			&amp;lt;fields&amp;gt;
				&amp;lt;field&amp;gt;lds:int_field&amp;lt;/field&amp;gt;
			&amp;lt;/fields&amp;gt;
		_	&amp;lt;properties widgetMode="edit"&amp;gt;
				&amp;lt;property name="required"&amp;gt;true&amp;lt;/property&amp;gt;
			&amp;lt;/properties&amp;gt;_
		&amp;lt;/widget&amp;gt;
	
	&amp;lt;/layout&amp;gt;

&amp;lt;/extension&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Define your own schema, for example layout_demo_schema and declare it in core_types-contrib.xml as below.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;schema name="layout_demo_schema" prefix="lds"
		src="schema/layout_demo_schema.xsd" /&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You need to define int_field type in layout_demo_schema.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;In ui-types-contrib.xml file define your custom document type and dont forget to declare the layout for document. Consider the below,

    &amp;lt;type id="Custom_file_type"&amp;gt;
		&amp;lt;icon&amp;gt;/icons/file.gif&amp;lt;/icon&amp;gt;
		&amp;lt;bigIcon&amp;gt;/icons/file_100.png&amp;lt;/bigIcon&amp;gt;
		&amp;lt;label&amp;gt;Custom_file_type&amp;lt;/label&amp;gt;
		&amp;lt;description /&amp;gt;
		&amp;lt;category&amp;gt;SimpleDocument&amp;lt;/category&amp;gt;
		&amp;lt;default-view&amp;gt;view_documents&amp;lt;/default-view&amp;gt;
		&amp;lt;layouts mode="any"&amp;gt;
			&amp;lt;layout&amp;gt;My_layout&amp;lt;/layout&amp;gt;
		&amp;lt;/layouts&amp;gt;
	&amp;lt;/type&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I got the solution like this. Hope you will find this helpful.&lt;/P&gt;</description>
    <pubDate>Thu, 29 Oct 2015 14:01:37 GMT</pubDate>
    <dc:creator>Pradeep_Bhat</dc:creator>
    <dc:date>2015-10-29T14:01:37Z</dc:date>
    <item>
      <title>How to add custom attributes to content</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-add-custom-attributes-to-content/m-p/313862#M863</link>
      <description>&lt;P&gt;I want to attach some custom attributes for e.g. weight (numeric) which uploading content using the DAM admin console. I also want to be able to fire a range query on this numeric field. From the 'Edit' section of the content, I could not find any way to add this custom field. Could you please suggest some way to do this? I may have to add multiple such attributes in future. Any help is really appreciated.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jun 2015 20:19:55 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-add-custom-attributes-to-content/m-p/313862#M863</guid>
      <dc:creator>jyr_</dc:creator>
      <dc:date>2015-06-07T20:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to add custom attributes to content</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-add-custom-attributes-to-content/m-p/313863#M864</link>
      <description>&lt;P&gt;To add custom attributes you need to load your own "layouts" which contains your desired attributes. You can add as many fields as u want.&lt;/P&gt;
&lt;P&gt;Create a file layout-contrib.xml file. You can define ur fields through widgets. In nuxeo, each field/attribute is defined through widget. Write your widget in layout-contrib.xml. For example,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;	&amp;lt;extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
	point="layouts"&amp;gt;
    &amp;lt;layout name="My_layout"&amp;gt;

		&amp;lt;templates&amp;gt;
			&amp;lt;template mode="any"&amp;gt;/layouts/layout_default_template.xhtml
			&amp;lt;/template&amp;gt;
		&amp;lt;/templates&amp;gt;
	
		&amp;lt;rows&amp;gt;
			&amp;lt;row&amp;gt;
				&amp;lt;widget&amp;gt;weight_widget&amp;lt;/widget&amp;gt;
			&amp;lt;/row&amp;gt;

     &amp;lt;widget name="weight_widget" type="int"&amp;gt;
        &amp;lt;labels&amp;gt;
				&amp;lt;label mode="any"&amp;gt;Weight &amp;lt;/label&amp;gt;
		&amp;lt;/labels&amp;gt;
			&amp;lt;translated&amp;gt;false&amp;lt;/translated&amp;gt;
			&amp;lt;fields&amp;gt;
				&amp;lt;field&amp;gt;lds:int_field&amp;lt;/field&amp;gt;
			&amp;lt;/fields&amp;gt;
		_	&amp;lt;properties widgetMode="edit"&amp;gt;
				&amp;lt;property name="required"&amp;gt;true&amp;lt;/property&amp;gt;
			&amp;lt;/properties&amp;gt;_
		&amp;lt;/widget&amp;gt;
	
	&amp;lt;/layout&amp;gt;

&amp;lt;/extension&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Define your own schema, for example layout_demo_schema and declare it in core_types-contrib.xml as below.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;schema name="layout_demo_schema" prefix="lds"
		src="schema/layout_demo_schema.xsd" /&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You need to define int_field type in layout_demo_schema.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;In ui-types-contrib.xml file define your custom document type and dont forget to declare the layout for document. Consider the below,

    &amp;lt;type id="Custom_file_type"&amp;gt;
		&amp;lt;icon&amp;gt;/icons/file.gif&amp;lt;/icon&amp;gt;
		&amp;lt;bigIcon&amp;gt;/icons/file_100.png&amp;lt;/bigIcon&amp;gt;
		&amp;lt;label&amp;gt;Custom_file_type&amp;lt;/label&amp;gt;
		&amp;lt;description /&amp;gt;
		&amp;lt;category&amp;gt;SimpleDocument&amp;lt;/category&amp;gt;
		&amp;lt;default-view&amp;gt;view_documents&amp;lt;/default-view&amp;gt;
		&amp;lt;layouts mode="any"&amp;gt;
			&amp;lt;layout&amp;gt;My_layout&amp;lt;/layout&amp;gt;
		&amp;lt;/layouts&amp;gt;
	&amp;lt;/type&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I got the solution like this. Hope you will find this helpful.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2015 14:01:37 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-add-custom-attributes-to-content/m-p/313863#M864</guid>
      <dc:creator>Pradeep_Bhat</dc:creator>
      <dc:date>2015-10-29T14:01:37Z</dc:date>
    </item>
  </channel>
</rss>

