Desktop and Mobile

How to Customize the Drive Metadata Edit Layouts

Updated: March 18, 2024

You have created your own document types and defined forms and view that show properties specific to your business and users. Your users leverage Nuxeo Drive to work on Nuxeo documents from their desktop and you want them to be able to enjoy the metadata edit feature of Nuxeo Drive.

Obviously you want them to be displayed the same properties as in the Nuxeo Platform web UI.

To do so:

  1. In Nuxeo Studio, create a new Form layout called myDriveLayout for instance.
  2. Fill in the View Layout and Edit Layout with relevant widgets. You will probably end up with similar information as on your custom document type layouts.
  3. Create a new XML Extension called DriveMetadataEdit for instance.
  4. Use the following content and adapt it to your needs:

    <extension target="org.nuxeo.ecm.platform.types.TypeService"
      point="types">
      <type id="mydocumenttype">
        <layouts mode="drive">
          <layout>#{layoutMode == 'edit'? 'myDriveLayout@edit' : 'myDriveLayout@view'}</layout>
        </layouts>
      </type>
    </extension>
    
    • Replace <type id="mydocumenttype"> with your document type id.
  5. If you want to enable a custom metadata edit view for additional document types:
    1. Repeat steps 1 and 2 to create additional layouts.
    2. Edit the DriveMetadataEdit extension and add new <type> ... </type> sections filled in with the appropriate document types ids and layouts names.
  6. Save and deploy.

Notes

  • Why not use the default View and Edit layouts of your custom document types? There are chances that the View and Edit layouts defined for your document types use the file:content widget, that enables to view and upload a file to the document. It wouldn't make much sense to display this field to users from the file itself. That's why you need to create a new layout for this Metadata edit view.